Power internet of things model training method, system, medium and device

CN122802216APending Publication Date: 2026-09-22ELECTRIC POWER RESEARCH INSTITUTE OF STATE GRID JIBEI ELECTRIC POWER CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610932294.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-26
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

[0003]然而,大多数联邦学习方法在电力物联网环境中仍面临严重安全挑战:恶意参与方可通过上传伪造的梯度实施模型投毒攻击,污染全局模型,导致训练失败或异常检测准确率下降;并且,相关方法缺乏有效的防御机制,一旦受攻击,需耗费大量资源重新训练,效率低下

Benefits of technology

[0009]本公开实施例中所提供的电力物联网模型训练方法、系统、介质及设备,通过将联邦学习与自适应恶意梯度检测机制相结合,在电力物联网场景下实现了分布式模型的协同训练,既降低了中心化数据收集的通信与隐私风险,又提升了模型对恶意节点的鲁棒性,显著增强了电力物联网模型训练的安全性与可靠性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122802216A_ABST
    Figure CN122802216A_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of power model training, and provides a power Internet of Things model training method, system, medium and device, which comprises: constructing a power federation system comprising one server and multiple clients; the server receives encrypted statistical information uploaded by each client, calculates an update intensity threshold of each client, and then distributes an initial model to each client; each client trains a local model based on a local data set and uploads model update parameters; the server detects malicious gradients of the uploaded parameters by using the update intensity threshold of each client, uses the detected parameters to obtain global update parameters through aggregation, and broadcasts the global update parameters to all clients for the next round of iteration; the above steps are repeated until a termination condition is met, and a trained model is obtained. The present embodiment enhances the security and reliability of power Internet of Things model training by introducing an update intensity threshold based on encrypted statistical information for malicious gradient detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of power model training technology, and more specifically, to a power Internet of Things (IoT) model training method, system, medium, and device. Background Technology

[0002] As a crucial component of the smart grid, the power Internet of Things (IoT) undertakes real-time data acquisition, transmission, and control tasks. With the expansion of the power IoT, security threats such as malicious attacks and data tampering are increasing, making efficient and accurate anomaly detection technology essential for ensuring system security. In practical applications, power systems are often operated by multiple independent companies, each unwilling to share local data for centralized model training due to data privacy and trade secret concerns. Federated learning, as a distributed framework, enables multi-party collaborative training while protecting data privacy, with each participant uploading only model parameters rather than raw data.

[0003] However, most federated learning methods still face serious security challenges in the power Internet of Things (IoT) environment: malicious actors can poison the model by uploading forged gradients, polluting the global model and causing training failure or a decrease in anomaly detection accuracy; in addition, the relevant methods lack effective defense mechanisms, and once attacked, they require a lot of resources to retrain, which is inefficient. Summary of the Invention

[0004] This disclosure provides at least one method, system, medium, and device for training a power Internet of Things (IoT) model. By introducing an update strength threshold based on encrypted statistical information for malicious gradient detection, it effectively resists malicious attacks while protecting the data privacy of each client, significantly enhancing the security and reliability of power IoT model training.

[0005] This disclosure provides a method for training a power Internet of Things (IoT) model, including: Construct a power federation system; wherein the power federation system includes one server and multiple clients; The server receives encrypted statistics uploaded by each client, calculates the update strength threshold for each client based on the encrypted statistics, and sends the pre-built initial model to each client. Each client determines the initial model as its local model; and trains the local model based on the local dataset obtained by each client to obtain model update parameters; each client uploads the model update parameters to the server; The server performs malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determines the global update parameters based on the detected model update parameters, and broadcasts the global update parameters to each client. Each client uses the received global update parameters as the local model parameters for the next iteration. Repeat the above steps of local model training, malicious gradient detection, global parameter update determination and broadcasting until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

[0006] This disclosure provides a power Internet of Things (IoT) model training system, including a server and multiple clients; The server is used to receive encrypted statistical information uploaded by each client, calculate the update strength threshold for each client based on the encrypted statistical information, and send the pre-built initial model to each client. Each client is used to determine the initial model as the local model corresponding to the client; and to train the local model corresponding to the client based on the local dataset obtained by each client to obtain model update parameters; and to upload the model update parameters to the server; The server is also used to perform malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determine the global update parameters based on the detected model update parameters, and broadcast the global update parameters to each client so that each client uses the received global update parameters as the local model parameters for the next iteration. The server and the client are also used to repeatedly perform the above-mentioned local model training, malicious gradient detection, global update parameter determination and broadcasting operations until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

[0007] This disclosure provides a computer device including a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the computer device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, they perform the power Internet of Things model training method as described in any of the above possible embodiments.

[0008] This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the power Internet of Things model training method as described in any of the possible embodiments above.

[0009] The power Internet of Things (IoT) model training method, system, medium, and device provided in this disclosure combine federated learning with an adaptive malicious gradient detection mechanism to achieve collaborative training of distributed models in the power IoT scenario. This reduces the communication and privacy risks of centralized data collection and improves the robustness of the model to malicious nodes, significantly enhancing the security and reliability of power IoT model training.

[0010] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0011] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings referenced in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0012] Figure 1 This diagram illustrates an application environment of a power Internet of Things (IoT) model training method provided in an embodiment of this disclosure. Figure 2 A flowchart of a power Internet of Things (IoT) model training method provided in an embodiment of this disclosure is shown; Figure 3 A flowchart of an updated intensity threshold calculation method provided by an embodiment of this disclosure is shown; Figure 4 A flowchart of a malicious gradient detection method provided by an embodiment of this disclosure is shown; Figure 5 This diagram illustrates the structure of a power Internet of Things (IoT) model training system provided in an embodiment of this disclosure. Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0014] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0015] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0016] As a crucial component of the smart grid, the power Internet of Things (IoT) undertakes critical tasks such as real-time monitoring, data transmission, and equipment control. However, with the expansion of the power IoT, it faces increasing security threats, such as malicious attacks, data tampering, and abnormal intrusions. These threats could lead to power system failures or even large-scale blackouts. Therefore, efficient and accurate anomaly detection technology is essential for ensuring the security of the power IoT.

[0017] In practical applications, power systems are typically managed by multiple independently operating companies or institutions. Due to concerns about data privacy and trade secrets, these companies are often unwilling to share local data for centralized model training. Federated learning, as a distributed machine learning framework, enables multi-party collaborative training of a global model while protecting data privacy. Each participant only needs to upload model parameters, not the raw data, thus meeting privacy requirements and improving model generalization capabilities.

[0018] Research has revealed that traditional federated learning methods still face numerous security challenges in the power Internet of Things (IoT) environment. For example, in model poisoning attacks, malicious actors can interfere with global model training by uploading forged gradients or model parameters, leading to decreased model performance or even training failure. Because traditional federated learning frameworks lack effective defense mechanisms when aggregating gradients or updating models, malicious power terminal devices can intentionally upload tampered or erroneous gradient data. These malicious updates pollute the global model, causing training failure, slow convergence, or the learning of incorrect features, thereby reducing anomaly detection accuracy and even leading to false negatives or missed positives. Furthermore, the repeated retraining required to handle or defend against malicious attacks makes the training process of traditional methods vulnerable when security is insufficient. Once attacked, not only is model security compromised, but more time and resources are needed for repair or retraining, resulting in low training efficiency.

[0019] Meanwhile, although federated learning itself does not share the original data, the original privacy data of users (such as specific electricity consumption behavior and equipment operation details) may still be deduced during the transmission of model update parameters or through side-channel attacks to analyze these parameters. This poses a risk of leakage to the sensitive datasets of power terminal equipment, and fails to meet the stringent requirements of the power Internet of Things for data privacy and high security.

[0020] Based on the above research, this disclosure provides a power Internet of Things (IoT) model training method, system, medium, and device. Specifically, a power federation system consisting of one server and multiple clients is constructed. The server receives encrypted statistical information uploaded by each client and calculates the update strength threshold for each client, then distributes the initial model to each client. Each client trains a local model based on its local dataset and uploads the model update parameters. The server uses the update strength threshold of each client to perform malicious gradient detection on the uploaded parameters, and uses the detected parameters to aggregate and obtain global update parameters, which are then broadcast to all clients for the next iteration. The above steps are repeated until the termination condition is met, resulting in a trained model.

[0021] In this embodiment of the disclosure, by combining federated learning with an adaptive malicious gradient detection mechanism, collaborative training of distributed models is realized in the power Internet of Things (IoT) scenario. This not only reduces the communication and privacy risks of centralized data collection, but also improves the robustness of the model to malicious nodes, significantly enhancing the security and reliability of power IoT model training.

[0022] To facilitate understanding of this embodiment, the execution entity of the power Internet of Things (IoT) model training method provided in this embodiment will first be described in detail. The power IoT model training method provided in this embodiment can be applied to, for example... Figure 1In the application environment shown, the client communicates with the server via a network. The client can be a power terminal device, including but not limited to smart meters, data acquisition terminals, edge computing gateways, and relay protection devices. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data, and artificial intelligence platforms.

[0023] The power Internet of Things (IoT) model training method provided in this application embodiment is described in detail below with reference to the accompanying drawings. See also... Figure 2 The diagram shows a flowchart of a power Internet of Things (IoT) model training method provided in this embodiment of the present disclosure. The method includes the following steps S201-S205: S201, Construct a federal power system.

[0024] It is understandable that a power federated system refers to a distributed machine learning system built on a federated learning architecture in the context of the power Internet of Things (IoT). This system is used to collaboratively train anomaly detection models among multiple power data holders, while avoiding direct sharing of raw power data among the parties. A power federated system can be constructed as follows: First, deploy an edge computing center as a server and run the federated learning server-side program on this server; then, deploy the federated learning client-side program on each power monitoring node or power terminal device; finally, connect each client to the server via a network to form a federated learning network where parameters can be exchanged but data is not shared.

[0025] In this disclosure, the power federation system includes a server and multiple clients. The server receives encrypted statistical information and model update parameters uploaded by each client, and performs operations such as malicious gradient detection, security aggregation, and global model update broadcasting. This server can be deployed in the power company's internal data center or on a dedicated power edge computing node. Clients refer to power terminal devices participating in federated model training; they are used to collect power operation data, perform local model training, and upload model update parameters to the server. For example, one client could be a smart meter that collects time-series data such as user electricity consumption, voltage, and current, and trains an anomaly detection model locally; another client could be a data acquisition terminal in a substation, responsible for collecting data such as transformer oil temperature, switch status, and load curves; or it could be an edge gateway in a distribution network, aggregating data from multiple lower-level sensors and performing model training. Each client possesses certain computing power, capable of running lightweight machine learning algorithms and performing block cipher encryption operations.

[0026] S202, the server receives encrypted statistical information uploaded by each client, calculates the update strength threshold for each client based on the encrypted statistical information, and sends the pre-built initial model to each client.

[0027] Specifically, encrypted statistics refer to data obtained by each client after counting the number of samples in each category in its local dataset and then encrypting it using an encryption algorithm. This encrypted statistics is privacy-preserving statistical data reported by the client to the server before model training begins. After receiving the encrypted statistics uploaded by each client, the server decrypts each ciphertext using a pre-negotiated key to obtain the number of samples in each category in each client's local dataset, and then calculates the total number of global samples and the total number of global samples for each category. Based on these statistics, the server can calculate a value for each client, called the update strength threshold. The update strength threshold combines the size of the client's local data and the degree of difference between the client's local data category distribution and the global distribution, and is a threshold value used to measure whether the model update parameters uploaded by the client are abnormal.

[0028] Here, the initial model refers to a pre-built, untrained neural network model on the server, capable of performing tasks such as detecting abnormal operating conditions of power equipment, detecting network attack traffic, and detecting data tampering. The model's structure can be a convolutional neural network, a recurrent neural network, or an autoencoder-based detection model. When building the initial model, the server can determine hyperparameters such as the input dimension, the number of hidden layer nodes, and the number of output categories based on the specific task requirements of the power Internet of Things (IoT). For example, for an anomaly detection task based on time-series data, the initial model can use a Long Short-Term Memory (LSTM) network, with the input being the current and voltage sequences of the past 24 hours and the output being a binary classification result of normal or abnormal. Before federated learning begins, the server copies the parameters of this initial model multiple times and distributes them to each client participating in the training. Each client receives an initial model with the exact same network structure and initial parameter values ​​to ensure consistency in the mathematical foundation of subsequent federated aggregation.

[0029] Specifically, the aforementioned encrypted statistics can be generated through the following steps (a) to (c): (a) For each client, count the number of samples of each category in the local dataset corresponding to the client and generate a statistical array; (b) Each client performs block cipher encryption on the statistical array to obtain encrypted statistical information; (c) Each client uploads the encrypted statistics to the server.

[0030] Understandably, a local dataset refers to the collection of power operation data stored by each client for training anomaly detection models. This dataset contains data derived from historical records and real-time acquisitions of the power equipment or sensors connected to the client, and can include historical monitoring data, real-time acquisition data, and manually labeled anomaly records. For example, a smart meter's local dataset might contain power, voltage, and current values ​​recorded every 15 minutes over the past three months, along with manually labeled tags indicating whether each data point represents an abnormal event (such as voltage sag, current overload, harmonic distortion, etc.). Each client's local dataset contains multiple sample categories, and the distribution of the number of samples in each category represents the proportion of different types of power operation states covered by that client. Here, the sample category indicates the anomaly or normal state type of the power data, and can include normal state categories, voltage sag categories, momentary power outage categories, equipment overheating categories, network attack traffic categories, and data tampering categories, etc. By traversing the local dataset, the client can count the number of samples in each category, and these counts, arranged in a predetermined order, form a statistical array. For example, if three categories are predefined: normal, voltage sag, and harmonic distortion, and a client obtains 5000 normal samples, 30 voltage sag samples, and 15 harmonic distortion samples, then its statistical array is [5000, 30, 15].

[0031] Specifically, each client can obtain a basic overview of its local data distribution by counting the number of samples in each category of its corresponding local dataset, and generate a statistical array accordingly. Each element in the statistical array is a non-negative integer representing the number of samples in the corresponding category, and all elements are arranged in order of category number. Each client can use a block cipher algorithm to encrypt the statistical array, converting the plaintext statistical array into ciphertext data that cannot be directly recognized, thereby protecting the client's data privacy. In the specific encryption process, the client can convert the statistical array into a binary byte sequence, then divide it into fixed-length data blocks, perform multiple rounds of encryption transformation on each data block using a preset key, and finally concatenate the encrypted statistical information to obtain the ciphertext, which is then uploaded to the server.

[0032] Here, block cipher encryption is a method that encrypts plaintext data by dividing it into blocks of fixed bit length and then encrypting each block using a key and cryptographic algorithm. This protects the confidentiality of data during transmission, prevents unauthorized third parties from accessing the plaintext content, and ensures the secure transmission of client statistical information. Block cipher encryption can be implemented using Advanced Encryption Standard (AES), the SM4 block cipher algorithm, or the Triple Encryption Standard (DES).

[0033] For example, the encryption process of the statistical array described above is illustrated using the SM4 block cipher algorithm. The client converts each integer in the statistical array into a four-byte binary representation. All integers are concatenated to form a total byte sequence, which is further divided into multiple sixteen-byte data blocks, each 128 bits long. Using a pre-negotiated 128-bit key with the server, the client performs thirty-two rounds of function operations on each data block. Each round may include S-box nonlinear substitution, cyclic shifting, and XOR operations, ultimately yielding the corresponding ciphertext data block. Concatenating all ciphertext data blocks forms the encrypted statistical information. Upon receiving this ciphertext, the server decrypts it using the same key and the reverse round key to recover the original statistical array.

[0034] Here, through block cipher encryption, the statistical information reported by the client exists in ciphertext form throughout the entire network transmission process. Even if an attacker intercepts the data packet, they will not be able to parse out any sample quantity information, thereby protecting the privacy of the client's data distribution.

[0035] Furthermore, after the server receives the encrypted statistical information uploaded by each client and decrypts it according to a preset decryption process, it can calculate the required update strength threshold for each client based on the decrypted plaintext statistical information, referring to... Figure 3 As shown, the calculation process may include the following steps S301~S303: S301, the server decrypts the encrypted statistical information uploaded by each client to obtain the statistical array of each client, and calculates the total number of global samples and the total number of global samples of each category based on the statistical arrays of all clients.

[0036] Understandably, after the server receives the encrypted statistical information uploaded by each client, it can first decrypt the ciphertext using a key pre-agreed with each client, restoring the encrypted statistical information to a plaintext statistical array, thus obtaining the sample quantity information for each category in each client's local dataset. Simultaneously, to subsequently calculate the base strength component and bias component for each client, global statistics can be obtained. This means calculating the total global sample count based on the statistical arrays of all clients, and calculating the total global sample count for each sample category. Here, the total global sample count refers to the total number of samples in all client local datasets, which can be obtained by summing the sample counts for each category in the statistical arrays of each client; it is a value measuring the global data scale. The total global sample count for each category represents the result of adding the sample counts for that category from all clients for a specific category, reflecting the overall frequency of that category in the entire power Internet of Things system.

[0037] For example, if the statistical array is encrypted using the national standard SM4 block cipher algorithm, the server can use the same national standard SM4 block cipher algorithm and the same key to decrypt the encrypted statistical information. The specific encryption and decryption processes are basically the same. The round keys are used in the forward order during encryption, and the round keys are used in the reverse order during decryption. That is, the key is applied in reverse from the last round to the first round, and the plaintext statistical array can be correctly recovered from the ciphertext.

[0038] S302, for each client, the server calculates the client's base strength component based on the number of local samples of the client and the total number of global samples, and calculates the client's bias component based on the number of samples of each category in the client's statistical array and the total number of global samples of each category.

[0039] Specifically, the base strength component is a value reflecting the proportion of the client's local data size to the global data size. The larger the value of this component, the more training data the client has, and the greater its expected contribution to the global model in federated learning. Therefore, the allowable range of model update parameter variations is also correspondingly larger. The base strength component can be determined by calculating the ratio of the total number of local samples on the client to the total number of global samples; that is, the larger the amount of local data on the client, the higher the base strength component.

[0040] Here, the calculation expression for the foundation strength components can be expressed as: ; in, Y represents the base strength component of the i-th client, which reflects the proportion of the client's local data size in the global data size; Y represents the total number of sample categories in the dataset, i.e., the number of all possible anomaly types or normal state types. This represents the number of samples belonging to the j-th category in the statistical array of the i-th client, which is the specific number of samples belonging to the j-th category in the local dataset of that client. This represents the total number of global samples, which is the sum of all class samples in all client local datasets.

[0041] Specifically, the bias component refers to a correction term reflecting the degree of difference between the local data category distribution on the client and the global data category distribution. This component compensates for normal update intensity fluctuations caused by non-independent and identically distributed data. When a client's local data is excessively concentrated or severely missing in certain categories, the direction of the update parameters generated by its local model training will deviate from the global ideal direction. This deviation manifests as an increased numerical value in the update intensity distance, but it is not caused by malicious attacks. The bias component quantifies this distribution difference to raise the client's threshold, preventing legitimate devices from being mistakenly identified as malicious nodes.

[0042] For example, when calculating the bias component based on the client's statistical array and the total number of samples in each category globally, for each category, the ratio of the number of samples of that category in the client to the total number of samples of that category globally can be calculated, and the logarithm to base 10 can be taken as the category difference measure for each category; and the category difference measures of all categories can be summed to obtain the distribution difference measure. The distribution difference measure is further normalized based on the total number of local samples in the client, i.e., divided by the total number of local samples and then multiplied by a scaling factor, to obtain the client's bias component. Here, the expression for calculating the bias component can be expressed as: ; in, This is represented as the bias component of the i-th client. This component reflects the degree of difference between the local data category distribution and the global data category distribution of the client, and is used to compensate for the normal update intensity fluctuations caused by the non-independent and identically distributed data. Represented as a scaling factor, it is a preset constant used to control the adjustment intensity of the bias component throughout the entire update intensity threshold. It can be set to a value between 0.1 and 10, for example, set to 1.0; It represents the total number of samples of class j in the global dataset, which is the sum of the number of samples belonging to class j in all client local datasets.

[0043] It should be noted that the embodiments of this application do not limit the specific calculation formulas for the base strength component and the bias component. Any technical solution that can comprehensively determine the threshold based on the positive correlation between the local data volume and the global data volume, as well as the degree of difference between the local and global distributions, falls within the scope of protection of this application. For example, the base strength component can also be calculated using the logarithm of the local sample size, and the bias component can use other probability distribution difference measurement methods, such as KL divergence, instead of logarithmic summation. The above examples are only for helping to understand the technical solutions of this application and should not be construed as specific limitations on this application.

[0044] S303, the server determines the update strength threshold for each client based on the client's base strength component and the bias component.

[0045] Furthermore, after calculating the base strength component and bias component for each client, the base strength component and bias component can be added together. The sum of the two is the update strength threshold for that client. This threshold is a numerical threshold used in subsequent malicious gradient detection steps to determine whether the model update parameters uploaded by that client are benign updates. Since the amount and distribution of local data differ for each client, the update strength threshold for each client is also personalized, which ensures the fairness and accuracy of malicious detection.

[0046] S203, each client determines the initial model as the local model corresponding to the client; and trains the local model corresponding to the client based on the local dataset obtained by each client to obtain model update parameters; each client uploads the model update parameters to the server.

[0047] Here, after each client receives the initial model uniformly distributed by the server, it can use this initial model as the starting point for its corresponding local model. That is, all network layer parameters of the initial model are directly copied without any modification. Each client uses its own stored local power operation dataset to train this local model. Through multiple iterations, the model parameters are optimized, allowing the local model to gradually fit the distribution characteristics of the local data. This enables the model to detect the operating status of local power equipment, such as detecting abnormal equipment operating status, network attack traffic, and data tampering. During model training, the client can use stochastic gradient descent or an adaptive moment estimator optimizer to divide the local dataset into multiple mini-batches, calculate the loss function sequentially, and backpropagate the gradient, updating the model parameters based on the gradient. After each complete local iteration, the client records the change in model parameters before and after training; this change is the updated model parameter. The updated model parameter is a vector or matrix set, where each element represents the adjustment magnitude of the corresponding network weight, reflecting the direction and degree of correction of the global model parameters by the local data. After obtaining the model update parameters, the client can quantize and compress them to reduce communication overhead, and then upload them to the server via the network to achieve the aggregation and fusion of the training results from various clients on the server side.

[0048] For example, when training their respective local models using local datasets from different clients, each client can randomly shuffle the samples in its local dataset and divide them into batches according to a preset batch size. For each batch of data, the client performs forward propagation to calculate the cross-entropy loss between the current model output and the true label, then performs backpropagation to calculate the gradient of the loss with respect to the parameters of each layer, and finally uses the optimizer to update the model parameters. This process is repeated until the entire local dataset has been traversed once, which is called one local training epoch. Typically, each client needs to perform multiple local training epochs, such as five or ten epochs, to fully absorb the information from the local data. After completing all local epochs, the client calculates the difference between the model parameters after training and the initial model parameters received before training began; this difference is the model update parameter. This process ensures that the model update parameter only reflects the incremental changes brought about by the local data, facilitating aggregation on the server side.

[0049] S204, the server performs malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determines the global update parameters based on the detected model update parameters, and broadcasts the global update parameters to each client. Each client uses the received global update parameters as the local model parameters for the next iteration.

[0050] Furthermore, after the server receives the model update parameters uploaded by each client, it can perform malicious gradient detection on these update parameters based on a pre-calculated update intensity threshold for each client. By comparing the update intensity distance with the threshold for each client, it can determine whether the update parameters of each client contain malicious poisoning behavior. Specifically, refer to... Figure 4 As shown, the malicious gradient detection process may include the following steps S401~S403: S401, the server calculates the initial global parameters based on the model update parameters uploaded by all clients.

[0051] Understandably, the initial global parameters are a temporary aggregation result used as a benchmark for subsequent calculations of the update intensity distance. When calculating the initial global parameters, the server first obtains the global model parameters corresponding to the current iteration. Here, if the current iteration is the first iteration, it means that no global aggregation has been performed before, and the global model parameters can be set to the model parameters of the initial model. If the current iteration is not the first iteration, the global model parameters can be set to the global update parameters determined in the previous iteration, that is, the parameter value broadcast to all clients in the previous round.

[0052] Furthermore, the server calculates the average of the model update parameters uploaded by all clients, that is, by taking the arithmetic mean of the update parameter vectors of all clients element by element to obtain the average update parameters. Then, the server uses the global model parameters and the average update parameters corresponding to the current iteration to calculate the initial global parameters. The initial global parameters integrate the update information from all clients, including potential malicious updates, and cannot be used directly as the final result, but they reflect the overall trend of the update direction of all clients in the current iteration.

[0053] Here, the formula for calculating the initial global parameters can be expressed as: ; in, This represents the initial global parameters calculated in the (g+1)th iteration; This represents the global model parameters at the end of the g-th iteration, i.e., the global parameters held by the server before the start of the current iteration. Represented as the learning rate, it is a preset positive number used to control the step size of model parameter updates. It can be set to a value between 0.001 and 0.1, for example, 0.01. This represents the total number of clients participating in this parameter aggregation. This represents the model update parameters uploaded by the i-th client.

[0054] S402, the server calculates the update intensity distance between the model update parameters uploaded by the client and the initial global parameters for each client.

[0055] Here, the update intensity distance represents the degree to which a client's update direction deviates from the average update direction of all clients. The greater the deviation, the more abnormal the client's update behavior, which may be due to extreme data distribution bias or malicious poisoning. The server determines the update intensity distance for each client by calculating the L2 norm of the difference between the model update parameter vector and the initial global parameter vector. This is achieved by subtracting the corresponding positions of the two vectors, summing the squares, and then taking the square root. This distance is a non-negative real number; a larger value indicates a more significant deviation.

[0056] S403, the server compares the update intensity distance of each client with the update intensity threshold of the client, and determines the model update parameters whose update intensity distance is less than the update intensity threshold of the client as the model update parameters that have passed the detection.

[0057] Furthermore, after obtaining the update intensity distance for each client, this distance can be compared with the previously calculated update intensity threshold for that client. If the update intensity distance is less than the client's update intensity threshold, it indicates that the client's update behavior is within the normal fluctuation range and does not constitute a malicious poisoning attack. In this case, the uploaded model update parameters can be identified as qualified model update parameters and used as candidate data for subsequent security aggregation. Conversely, if the update intensity distance is greater than or equal to the threshold, the client's update is judged as malicious, and its parameters will be discarded and not participate in the global update.

[0058] Specifically, after detecting all clients and obtaining the set of model update parameters that passed the detection, the server re-aggregates these benign parameters through federated averaging. That is, it calculates only the average of the detected model update parameters, then subtracts the learning rate from the current global model parameters and multiplies this average to obtain the final global update parameters. The server broadcasts these global update parameters to each client so that each client can update its local model, thereby achieving safe and reliable federated iterative training. The global update parameters refer to the new model parameters obtained by aggregating only contributions from benign clients after malicious gradient detection and filtering; they serve as the global benchmark for the next iteration.

[0059] S205, repeat the above steps of local model training, malicious gradient detection, global update parameter determination and broadcasting until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

[0060] Here, by repeatedly executing the local model training, model update parameter uploading, malicious gradient detection, security aggregation, and global parameter broadcasting operations in steps S203-S204 above, the local knowledge of each client can be continuously integrated into the global model. This allows the anomaly detection capability of the global model to gradually improve with each iteration until a preset iteration termination condition is met. When the termination condition is met, it indicates that the global model has converged to its optimal state or reached the performance level required by the application. At this point, the parameters of the local models held by each client are consistent with the final global model parameters of the server, resulting in a well-trained power IoT model. This model can be deployed to various power terminal devices or edge gateways to perform anomaly detection on real-time collected time-series data such as current, voltage, and power, determining whether there are abnormal events such as equipment failure, network attacks, or data tampering.

[0061] Specifically, the preset iteration termination conditions are pre-defined rules for determining whether training has ended, and can include two common types. The first type is when the number of global iteration communication rounds reaches a preset maximum communication round threshold, such as 100 or 200 rounds. When the actual number of global aggregations equals this threshold, training is forcibly stopped even if the model has not fully converged to prevent infinite loops. The second type is when the accuracy of the power IoT model on the validation dataset meets preset accuracy requirements. The validation dataset is a set of labeled samples independent of the training data, containing various normal and abnormal cases. It can be public power data samples pre-stored on the server, or a small amount of labeled data collected from various clients. Every few rounds, the server or third-party evaluation node uses the validation dataset to test the accuracy, recall, or F1 score of the current global model. When these metrics reach preset target values, such as an anomaly detection accuracy exceeding 95%, the model can be deemed to meet application requirements, and training can be terminated early.

[0062] In some other embodiments, the above-mentioned preset iteration termination condition can also be set as a combination of two conditions, that is, training is terminated when either condition is met, or other convergence criteria such as the global model parameter update amount being less than a preset threshold are not specifically limited here.

[0063] The power Internet of Things (IoT) model training method, system, medium, and device provided in this disclosure combine federated learning with an adaptive malicious gradient detection mechanism to achieve collaborative training of distributed models in the power IoT scenario. This reduces the communication and privacy risks of centralized data collection and improves the robustness of the model to malicious nodes, significantly enhancing the security and reliability of power IoT model training.

[0064] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0065] Based on the same inventive concept, this disclosure also provides a power Internet of Things (IoT) model training system corresponding to the power IoT model training method. Since the principle of the system in this disclosure for solving the problem is similar to the power IoT model training method described above, the implementation of the system can refer to the implementation of the method, and the repeated parts will not be described again.

[0066] Reference Figure 5 The diagram shown is a schematic of a power Internet of Things (IoT) model training system provided in an embodiment of this disclosure. The system includes a server and multiple clients. The server is used to receive encrypted statistical information uploaded by each client, calculate the update strength threshold for each client based on the encrypted statistical information, and send the pre-built initial model to each client. Each client is used to determine the initial model as the local model corresponding to the client; and to train the local model corresponding to the client based on the local dataset obtained by each client to obtain model update parameters; and to upload the model update parameters to the server; The server is also used to perform malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determine the global update parameters based on the detected model update parameters, and broadcast the global update parameters to each client so that each client uses the received global update parameters as the local model parameters for the next iteration. The server and the client are also used to repeatedly perform the above-mentioned local model training, malicious gradient detection, global update parameter determination and broadcasting operations until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

[0067] In some possible embodiments, the client is specifically used for: Count the number of samples in each category in the local dataset corresponding to the client, and generate a statistical array; The statistical array is encrypted using a block cipher to obtain encrypted statistical information; The encrypted statistical information is uploaded to the server.

[0068] In some possible embodiments, the server is specifically used for: The encrypted statistical information uploaded by each client is decrypted to obtain the statistical array of each client, and the total number of global samples and the total number of global samples of each category are calculated based on the statistical arrays of all clients. For each client, the base strength component of the client is calculated based on the number of local samples of the client and the total number of global samples, and the bias component of the client is calculated based on the number of samples of each category in the client's statistical array and the total number of global samples of each category. For each client, an update strength threshold is determined based on the client's base strength component and the bias component.

[0069] In some possible embodiments, the server is specifically used for: For each category, a category difference metric is determined based on the number of samples of that category in the client and the total number of global samples of that category; and the category difference metrics of all categories are aggregated to obtain a distribution difference metric. The distribution difference metric is normalized based on the number of local samples of the client to obtain the bias component of the client.

[0070] In some possible embodiments, the server is specifically used for: Calculate the initial global parameters based on the model update parameters uploaded by all clients; For each client, calculate the update intensity distance between the model update parameters uploaded by the client and the initial global parameters; The update intensity distance of each client is compared with the update intensity threshold of the client, and the model update parameters whose update intensity distance is less than the update intensity threshold of the client are determined as the model update parameters that pass the detection.

[0071] In some possible embodiments, the server is specifically used for: Obtain the global model parameters corresponding to the current iteration round; wherein, if the current iteration is the first iteration, the global model parameters are the model parameters of the initial model; if the current iteration is not the first iteration, the global model parameters are the global update parameters determined in the previous iteration. Calculate the average value of the model update parameters uploaded by all clients, and determine the initial global parameters based on the global model parameters corresponding to the current iteration round and the average value.

[0072] In some possible embodiments, the preset iteration termination condition includes: the number of global iteration communication rounds reaches a preset maximum communication rounds threshold; or, the accuracy of the power Internet of Things model on the verification dataset meets a preset accuracy requirement.

[0073] Based on the same technical concept, this disclosure also provides a computer device. (See also...) Figure 6 The diagram shows the structure of a computer device 600 provided in this embodiment of the present disclosure, including a processor 601, a memory 602, and a bus 603. The memory 602 stores execution instructions and includes a main memory 6021 and an external memory 6022. The main memory 6021, also called internal memory, is used to temporarily store computational data in the processor 601 and data exchanged with external memory 6022 such as a hard disk. The processor 601 exchanges data with the external memory 6022 through the main memory 6021.

[0074] In this embodiment, the memory 602 is specifically used to store application code that executes the solution of this application, and its execution is controlled by the processor 601. That is, when the computer device 600 is running, the processor 601 communicates with the memory 602 through the bus 603, so that the processor 601 executes the application code stored in the memory 602, and then executes the method described in any of the foregoing embodiments.

[0075] The memory 602 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0076] Processor 601 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor.

[0077] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the computer device 600. In other embodiments of this application, the computer device 600 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0078] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the power Internet of Things model training method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0079] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the power Internet of Things model training method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0080] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0081] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and devices described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0082] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0083] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0084] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0085] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit them. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure.

Claims

1. A method for training a power Internet of Things (IoT) model, characterized in that, include: Construct a power federation system; wherein the power federation system includes one server and multiple clients; The server receives encrypted statistics uploaded by each client, calculates the update strength threshold for each client based on the encrypted statistics, and sends the pre-built initial model to each client. Each client determines the initial model as its local model; and trains the local model based on the local dataset obtained by each client to obtain model update parameters; each client uploads the model update parameters to the server; The server performs malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determines the global update parameters based on the detected model update parameters, and broadcasts the global update parameters to each client. Each client uses the received global update parameters as the local model parameters for the next iteration. Repeat the above steps of local model training, malicious gradient detection, global parameter update determination and broadcasting until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

2. The method according to claim 1, characterized in that, Before the server receives encrypted statistical information uploaded by each client, it includes: Each client counts the number of samples of each category in its local dataset and generates a statistical array; Each client performs block cipher encryption on the statistical array to obtain encrypted statistical information; Each client uploads the encrypted statistics to the server.

3. The method according to claim 2, characterized in that, The calculation of the update strength threshold for each client based on the encrypted statistics includes: The server decrypts the encrypted statistical information uploaded by each client to obtain the statistical array of each client, and calculates the total number of global samples and the total number of global samples of each category based on the statistical arrays of all clients. For each client, the server calculates the client's base strength component based on the number of local samples and the total number of global samples, and calculates the client's bias component based on the number of samples of each category in the client's statistical array and the total number of global samples of each category. For each client, the server determines the update strength threshold based on the client's base strength component and the bias component.

4. The method according to claim 3, characterized in that, The calculation of the client's bias component based on the number of samples in each category of the statistical array of the client and the total number of global samples in each category includes: For each category, the server determines a category difference metric based on the number of samples of that category in the client and the total number of global samples of that category; and aggregates the category difference metrics of all categories to obtain a distribution difference metric. The server normalizes the distribution difference metric based on the number of local samples of the client to obtain the bias component of the client.

5. The method according to claim 1, characterized in that, The server performs malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, including: The server calculates the initial global parameters based on the model update parameters uploaded by all clients; For each client, the server calculates the update intensity distance between the model update parameters uploaded by the client and the initial global parameters. The server compares the update intensity distance of each client with the update intensity threshold of the client, and determines the model update parameters whose update intensity distance is less than the update intensity threshold of the client as the model update parameters that pass the detection.

6. The method according to claim 5, characterized in that, The server calculates initial global parameters based on the model update parameters uploaded by all clients, including: The server obtains the global model parameters corresponding to the current iteration round; wherein, if the current iteration is the first iteration, the global model parameters are the model parameters of the initial model; if the current iteration is not the first iteration, the global model parameters are the global update parameters determined in the previous iteration. The server calculates the average value of the model update parameters uploaded by all clients, and determines the initial global parameters based on the global model parameters corresponding to the current iteration and the average value.

7. The method according to any one of claims 1 to 6, characterized in that, The preset iteration termination conditions include: the number of global iteration communication rounds reaches a preset maximum communication rounds threshold; or, the accuracy of the power Internet of Things model on the verification dataset meets the preset accuracy requirements.

8. A power Internet of Things (IoT) model training system, characterized in that, The system includes a server and multiple clients; The server is used to receive encrypted statistical information uploaded by each client and calculate the update strength threshold for each client based on the encrypted statistical information. And, send the pre-built initial model to each client; Each client is used to determine the initial model as the local model corresponding to the client; and to train the local model corresponding to the client based on the local dataset obtained by each client to obtain model update parameters; and to upload the model update parameters to the server; The server is also used to perform malicious gradient detection on the model update parameters uploaded by each client based on the update intensity threshold of each client, determine the global update parameters based on the detected model update parameters, and broadcast the global update parameters to each client so that each client uses the received global update parameters as the local model parameters for the next iteration. The server and the client are also used to repeatedly perform the above-mentioned local model training, malicious gradient detection, global update parameter determination and broadcasting operations until the preset iteration termination condition is met, and each client obtains the trained power Internet of Things model.

9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.

10. A computer device, comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 7.