Federal prompt adversarial learning-based power supply prediction method and system
By employing a federated cue adversarial learning method, utilizing generative adversarial networks and cue vectors, the privacy risks and data adaptability issues in cross-regional power data sharing are addressed. This approach enables high-precision, interpretable, and efficient power supply forecasting, applicable to power grid operation optimization and renewable energy management.
Patent Information
- Application Number
- CN202511858528.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-03-20
AI Technical Summary
Cross-regional power data sharing poses a risk of privacy breaches. Traditional federated learning methods struggle to adapt to the local data characteristics of each party, leading to decreased prediction accuracy. Existing personalized federated learning methods fail to effectively distinguish between global and local model knowledge, impacting prediction accuracy.
We employ a federated cue adversarial learning approach. By introducing learnable cue vectors and a generative adversarial network into the local model, we construct a generator and a discriminator, perform adversarial training, improve the local model's adaptability to local data distribution, and maintain the consistency of the global model.
It improves the accuracy and adaptability of power supply forecasting, enhances the interpretability and deployment convenience of the model, reduces system complexity, protects data privacy and computing and communication efficiency, and improves grid operation efficiency and renewable energy absorption capacity.
Smart Images

Figure CN121705709A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power supply prediction technology, specifically relating to a power supply prediction method and system based on federated prompt adversarial learning. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Power systems require accurate load forecasting based on seasonal and regional variations to ensure power supply balance and improve energy efficiency. Since climate and electricity consumption patterns differ significantly across latitudes, referencing grid data from other regions or countries can help improve forecasting accuracy. However, power data involves core and sensitive information about grid operations from various parties; directly sharing data for collaborative modeling poses privacy risks, hindering the development of cross-regional joint forecasting.
[0004] Federated learning, a machine learning framework designed to protect privacy, enables joint training of predictive models across institutions. It effectively addresses the aforementioned privacy and security challenges by allowing models to be trained collaboratively without disclosing local data. However, due to factors such as geographical location, management methods, and user structure, the distribution of electricity data among collaborating parties often varies significantly. Directly using traditional federated learning methods to train a unified global model struggles to adequately adapt to the characteristics of each party's local data, leading to performance degradation when implementing predictions in specific regions.
[0005] To mitigate the impact of data heterogeneity, academia has proposed several personalized federated learning strategies, mainly including pre-training fine-tuning, knowledge distillation, and personalized federated learning. Pre-training fine-tuning first trains a global model through federated learning, and then each participant fine-tunes the model based on local data to obtain a model that better fits the local distribution. Distillation methods, after the global model is trained, use a distillation mechanism to train a lightweight model that integrates global knowledge and adapts to local characteristics using local data. Personalized federated learning methods directly introduce local personalized parameters during federated training, making the local model differentiated from the global model during collaborative training. However, existing methods do not explicitly constrain the differences in knowledge learned by the global model and the local model during the personalization process, resulting in potentially high similarity between the learned representations. This limits the local model's ability to fit its own data distribution and affects the final prediction accuracy. Summary of the Invention
[0006] To address the aforementioned issues, this invention proposes a power supply prediction method and system based on federated cueing adversarial learning. This invention aims to further enhance the local model's learning ability regarding regional power data distribution, improving the accuracy and adaptability of power supply prediction. By utilizing cueing learning, personalized federated learning is achieved without compromising the consistency between the local and global prediction models, thus preserving the global prediction model's power supply prediction capabilities. This makes the federated learning training process highly interpretable compared to methods where the structures of the global and local prediction models differ. This invention leverages adversarial learning to help the local model within the federated power supply prediction framework better distinguish between local and global knowledge, thereby improving the performance of local power supply prediction.
[0007] According to some embodiments, the first aspect of the present invention provides a power supply prediction method based on federated prompting adversarial learning, employing the following technical solution: A power supply prediction method based on federated prompting adversarial learning includes: The central server initializes the parameters of the global prediction model and the local prediction models in each partner. Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model and uploads the parameter gradient of the local prediction model to the central server. The central server aggregates the parameter gradients from each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Each partner receives the average parameter gradient and updates the parameters of its local prediction model. Periodic cyclical federated training involves each partner using updated local prediction models based on real-time power supply data to obtain future predicted power supply data.
[0008] Furthermore, each partner utilizes local historical power supply data and pre-built cue vectors to train a local prediction model, and uploads the parameter gradients of the local prediction model to the central server, including: An adversarial network is formed by using a local prediction model as a generator and a local discriminant model as a discriminant. The parameters of the local prediction model are fixed. The local discriminant model is iteratively trained using the pre-built prompt vector, local historical power supply data, and historical measured power supply data for the prediction period as training data until the discriminant loss is minimized, thus obtaining the trained local discriminant model. The parameters of the pre-trained local discriminative model are fixed. The local prediction model is iteratively trained using the pre-built local cue vector and local historical power supply data as training data until the sum of the prediction loss and adversarial loss is minimized, thus obtaining the pre-trained local prediction model. The gradient of the parameters of the trained local prediction model is uploaded to the central server.
[0009] Furthermore, the parameters of the fixed local prediction model are used as training data, with pre-built local cue vectors, local historical power supply data, and historical measured power supply data for the prediction period. The local discrimination model is iteratively trained until the discrimination loss is minimized, resulting in a trained local discrimination model, including: The local pre-built prompt vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data. Based on the predicted power supply data and the historical measured power supply data for the predicted time period, a local discrimination model is used to make a discrimination, and the category probability corresponding to the historical predicted power supply data and the category probability corresponding to the historical measured power supply data are output. Iterate through the training process until the discrimination loss is minimized to obtain a well-trained local discrimination model.
[0010] Furthermore, a local prediction model is trained based on the training input data to obtain predicted power supply data, including: For the training input data, an embedding model is used to map it into a high-dimensional feature vector; Using a time-domain model, high-dimensional feature vectors are transformed into time-series feature vectors that capture time dependencies; Using a decoding model, the time-series feature vector Mapping to the output space yields the predicted power supply data.
[0011] Furthermore, with the parameters of the pre-trained local discriminative model fixed, the local prediction model is iteratively trained using pre-built local cue vectors and local historical power supply data as training data until the sum of the prediction loss and adversarial loss is minimized, resulting in a pre-trained local prediction model, including: The local pre-built prompt vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data. Based on the predicted power supply data, a trained local discrimination model is used to make a discrimination and obtain the category probability corresponding to the historical predicted power supply data. Iterate through the training process until the sum of the prediction loss and the adversarial loss is minimized, resulting in a well-trained local prediction model.
[0012] Furthermore, the predicted loss ,as follows:
[0013] in, Use it to calculate the distance between two inputs. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample Indicates the first Historical measured power supply data for each sample prediction period.
[0014] Furthermore, the aforementioned resistance loss ,as follows:
[0015] in, This represents the confidence level of the discriminative model, where the output is in the range [0,1]. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample.
[0016] Furthermore, the discriminative loss ,as follows:
[0017] in, This represents the confidence level of the discriminative model, where the output is in the range [0,1]. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample Indicates the first Historical measured power supply data for each sample prediction period.
[0018] Furthermore, the global prediction model and the local prediction model are the same model.
[0019] According to some embodiments, a second aspect of the present invention provides a power supply prediction system based on federated prompting adversarial learning, employing the following technical solution: A power supply prediction system based on federated cue adversarial learning includes numerous collaborators and a central server. The training and prediction process of each collaborator and the central server is as follows: The central server initializes the parameters of the global prediction model and the local prediction models in each partner. Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model and uploads the parameter gradient of the local prediction model to the central server. The central server aggregates the parameter gradients from each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Each partner receives the average parameter gradient and updates the parameters of its local prediction model. Periodic cyclical federated training involves each partner using updated local prediction models based on real-time power supply data to obtain future predicted power supply data.
[0020] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention achieves high personalization while effectively maintaining the consistency of the global prediction model, thus safeguarding the fundamental advantages of collaborative modeling. Traditional personalized federated learning methods introduce independent structures or parameters into local models, leading to significant discrepancies in the representation space between local and global prediction models, weakening the collective knowledge foundation of federated collaboration. This invention introduces a cue-based learning mechanism, achieving personalization solely by adding lightweight, learnable cue parameters to the model input side. This design ensures that the core structure of each participant's local model remains consistent with the global prediction model, fundamentally preserving the more generalizable global knowledge representation obtained through federated learning aggregation. Therefore, this method not only flexibly adapts to the unique electricity consumption patterns of different regions but also ensures that all participants share a robust and universal prediction foundation, enhancing the model's generalization ability and stability when facing unknown or cross-regional patterns.
[0021] This invention significantly improves the interpretability and deployment ease of the model. Because the core architecture of the local and global prediction models is completely unified, distinguished only by input prompt parameters, the behavioral logic of the entire federated learning system is clearer and easier to analyze. Compared to methods where the local and global prediction models have different structures, this avoids complex model structure alignment and parameter fusion issues, greatly reducing system complexity. This design simplifies the model update, maintenance, and deployment process, providing great convenience for engineering practice. It also makes the model decision-making process (such as the impact of different prompt parameters on prediction) easier to trace and understand, meeting the inherent requirements of high-reliability power systems for model interpretability.
[0022] This invention utilizes an adversarial learning mechanism to proactively drive local models to deepen their learning of region-specific data distributions, thereby significantly improving local prediction accuracy. A Generative Adversarial Network (GAN) framework is introduced at the local level. Through adversarial training between the local discriminator and the prediction model (as a generator), a powerful "driving signal" is created. This discriminator forces the prediction sequences generated by the local prediction model to approximate the actual local power load curve in terms of distribution, thus proactively and strongly guiding the model to capture and fit those crucial details and dynamic patterns that might be smoothed out by the global prediction model. This mechanism is equivalent to equipping each local model with a "dedicated coach" focused on its own data characteristics, effectively promoting the decoupling and deepening of learning between globally shared knowledge and locally specific knowledge. This results in the final local model exhibiting superior accuracy and robustness in power supply prediction tasks within its own region.
[0023] This invention constructs a highly efficient, privacy-secure, and adaptable joint prediction framework with promising practical applications. It organically combines the parameter efficiency of cue learning, the distribution fitting capability of adversarial learning, and the privacy protection advantages of federated learning. The entire training process is conducted entirely within the data domain, strictly ensuring data security for all parties. Lightweight cue parameter and discriminator training reduces the overhead of local computation and federated communication compared to training a complete model. This framework can flexibly address the heterogeneity of power grid data distribution across different regions, providing an efficient, reliable, and scalable technical path for building national or regional collaborative power prediction platforms, ultimately contributing to improving the overall power grid operating efficiency, renewable energy absorption capacity, and power supply security. Attached Figure Description
[0024] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0025] Figure 1 This is a framework diagram of a power supply prediction method based on federated prompting adversarial learning in an embodiment of the present invention; Figure 2 This is a schematic diagram of the input and output of the local prediction model in an embodiment of the present invention; Figure 3 This is a schematic diagram of the input and output of the local discrimination model in an embodiment of the present invention; Figure 4 This is a data flow diagram of a power supply prediction method based on federated prompting adversarial learning in an embodiment of the present invention. Detailed Implementation
[0026] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0027] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0028] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0029] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0030] Example 1 This embodiment provides a power supply prediction method based on federated prompting adversarial learning. In this embodiment, the method includes the following steps: Step S1: The central server initializes the parameters of the global prediction model and the local prediction models of each partner; Step S2: Each partner uses local historical power supply data and pre-built cue vectors to train the local prediction model and uploads the parameter gradient of the local prediction model to the central server. Step S3: The central server aggregates the parameter gradients of each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Step S4: Each partner receives the average parameter gradient and updates the parameters of its local prediction model; Step S5: Periodic cyclic federated training steps S2-S4, each partner uses the updated local prediction model to make predictions based on real-time power supply data, and obtains future predicted power supply data.
[0031] like Figure 1 and Figure 4 As shown, the method described in this embodiment includes three aspects of modeling: local personalized modeling based on cue learning, local personalized modeling based on adversarial learning, and unified modeling based on federated learning; wherein, Local personalized modeling based on cue learning: Each partner's local prediction model takes personalized, learnable cue vectors and historical power supply data as inputs and outputs predicted power supply data, thus realizing the difference between the local model and the global prediction model at the input level.
[0032] Local personalized modeling based on adversarial learning: Each collaborator trains a local discriminator, which takes the predicted power supply data from the previous part as input and determines whether it is real data or generated data. The local prediction model and the local discriminator model are combined into a generative adversarial network, which uses adversarial learning to help the local model fit the local data distribution more fully, thereby improving the performance of local power supply prediction.
[0033] Unified modeling based on federated learning: A unified global prediction model is trained using federated learning. The architecture of the global prediction model is consistent with that of the local prediction models of each collaborator. The parameter gradients uploaded by each collaborator are federated and aggregated. The averaged parameter gradients are then sent back to each collaborator.
[0034] Step S1: The central server initializes the parameters of the global prediction model and the local prediction models of each partner; Specifically, the parameters of the global prediction model and the local prediction model are initialized to obtain the initial parameters of the global prediction model and the local prediction model. The architecture of the global prediction model is consistent with the architecture of the local prediction models of each partner, and the length of the input data for both is also the same. That is to say, the local prediction model of each partner is essentially a copy of the global prediction model, and the model is trained using local historical power supply data. The model architecture can adopt, but is not limited to, time-series based deep neural networks, such as LSTM, Temporal Convolution Network (TCN), or Transformer structures, to capture the temporal dependencies of power load. During the training process, each node modulates the input features with a prompt embedding, enabling the model to automatically adapt to differences in regional characteristics, climate conditions, and electricity consumption habits.
[0035] Step S2: Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model, and uploads the parameter gradients of the local prediction model to the central server, including: An adversarial network is formed by using a local prediction model as a generator and a local discriminant model as a discriminant. Local training consists of two parts: prediction training and adversarial training. Prediction training forces the local prediction model to predict future power supply data as accurately as possible. Adversarial training is divided into two parts: discriminative training forces the local discriminative model to distinguish between input data from real power supply data and predicted power supply data as much as possible, and generative training forces the local prediction model to deceive the local discriminative model as much as possible, so that the prediction results of the local prediction model can be indistinguishable from real power supply data, thereby improving the accuracy of prediction.
[0036] Train a local discriminative model to form an adversarial network with a local prediction model. The local discriminative model takes as input the predicted power supply data or historical measured power supply data for the predicted time period and is used to determine whether the data is real or fake. The principle here is that during adversarial training, the local discriminative model is trained to distinguish between predicted and real input data as much as possible, while the local prediction model is trained to deceive the local discriminative model as much as possible. This makes the local prediction model more adapted to the distribution of local data, thereby improving the accuracy of predictions.
[0037] With the parameters of the local prediction model fixed, the local discriminative model is iteratively trained using pre-built local cue vectors, local historical power supply data, and historical measured power supply data for the prediction period as training data, until the discriminative loss is minimized, thus obtaining the trained local discriminative model. The process is as follows: The pre-built local cue vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data, including: The pre-built local cue vector and local historical power supply data are concatenated to obtain the training input data, as follows: like Figure 2 As shown, firstly, regarding historical power supply data... Set a learnable cue vector. The two data points are concatenated and used together as the training input data for the local prediction model. ,in Represents the real number field. This indicates the time step length of historical power supply data. This represents the length of the learnable cue vector. This indicates a concatenation operation. Note that the cue vector needs to be concatenated before the historical power supply data to ensure that the local prediction model can use the temporal continuity of the power supply data to predict future power supply data.
[0038] This mechanism generates a set of learnable cue vectors based on the statistical characteristics and task context (such as region ID, load type, and time period pattern) of each node. These cue vectors are embedded in the model's input layer or intermediate layers to guide the model in capturing local differences without sharing the original data. This mechanism allows different nodes to maintain local adaptability while sharing global model parameters, thereby improving prediction accuracy and generalization performance.
[0039] Historical power supply data is collected to form an offline power database for use in federated training. This historical power supply data includes, but is not limited to, load power, substation outgoing current, voltage, power quality indicators, meteorological information (temperature, humidity, wind speed, etc.), and auxiliary feature data such as holidays and electricity consumption categories. It is understood that the historical power supply data used for federated training is based on the original historical power supply data, which has been preprocessed to extract time-series features (such as the average value, deviation, and periodicity of the sliding window) and contextual features (such as load peak-valley difference, holiday markers, and regional feature encoding) to generate a multi-dimensional input vector – historical power supply data – which is then stored in the offline power database. The offline power database can adopt a distributed storage architecture (such as HDFS or TimescaleDB) to support the storage and retrieval of large-scale power time-series data. The data in this offline power database is not directly uploaded to the central server; it only participates in the calculation of local prediction model parameters or gradients of each collaborator during the federated learning process, thereby achieving privacy protection.
[0040] Real-time acquisition of online power data streams, used as real-time power supply data for local forecasting; Based on the training input data, a local prediction model is used to make predictions, resulting in the predicted power supply data, as follows: The training input data in the real number field is mapped to a high-dimensional feature space, and time dependencies are constructed to predict power supply data for a future period.
[0041] Specifically, for training input data Using the embedding model Mapped to high-dimensional feature vectors ,as follows:
[0042] in, Let be the dimension of the feature space. This refers to matrix multiplication.
[0043] Then, time dependencies are constructed using a time-domain model. , to high-dimensional feature vector Transform into temporal feature vectors that capture time dependencies ,as follows:
[0044] Finally, the decoding model is used. , time series feature vector Mapped to the output space, the predicted power supply data is obtained. ,as follows:
[0045] in, The time step length for predicting power supply data.
[0046] Based on the predicted power supply data and the historical measured power supply data for the predicted time period, a local discriminant model is used to make a judgment, and the class probability corresponding to the historical predicted power supply data and the class probability corresponding to the historical measured power supply data are output. The process is as follows: like Figure 3 As shown, the input to the local discriminative model is either predicted power supply data or historical measured power supply data for the predicted time period, used to determine whether the data comes from real or fake sources. The principle here is that during adversarial training, the local discriminative model is trained to distinguish as much as possible between predicted and real input data, and the local prediction model is trained to deceive the discriminative model as much as possible. This makes the local prediction model more adaptable to the distribution of local data, thereby improving the accuracy of predictions.
[0047] Specifically, the local discriminant model It is a binary classifier that takes its input predicted power supply data Or historical measured power supply data for the predicted time period Mapping to logical features The formula is as follows:
[0048] in, , For the logical features corresponding to category 1, The logical feature corresponding to category 2; The input to the discriminator can be historical measured power supply data for the predicted time period. Or the predicted power supply data output by the local prediction model. .
[0049] Then, the local discriminant model uses the softmax function to obtain the confidence score of the class, as shown in the following formula:
[0050] in, , The confidence score for category 1. The confidence level corresponding to category 2. It is the natural base.
[0051] Without loss of generality, if we define category 1 as model input derived from real power supply data, then... To determine the probability that the model input comes from real power supply data; Category 2 is where the model input comes from a predictive model, then... The local discriminant model takes probabilities from the prediction model as input to the discriminant model. The final output of the local discriminant model is... Used for subsequent training.
[0052] It is important to note the model parameters here. , , , It is not a deterministic linear mapping, but rather a general model representation that can achieve the effect of dimension mapping. In specific implementations, it can be a linear mapping MLP, a convolutional neural network CNN, a recurrent neural network RNN, a long short-term memory network LSTM, a Transformer, and other network structures.
[0053] Iterative training continues until the discriminative loss is minimized, resulting in a well-trained local discriminative model. The discriminative loss for all samples is calculated and optimized as follows:
[0054] in, This represents the confidence level of the discriminative model, where the output is in the range [0,1]. Indicates the first Historical power supply data for each sample Indicates the first The historical measured power supply data for each sample prediction time period. Optimizing this loss will make the first term of the expression... The loss should be as small as possible, forcing the discriminator to output as close to zero as possible for the predicted data. Optimizing this loss will make the second term of the expression... The larger the value, the more likely the discriminator will output 1 for the true data.
[0055] With fixed parameters of the pre-trained local discriminative model, and using pre-built local cue vectors and local historical power supply data as training data, the local prediction model is iteratively trained until the sum of the prediction loss and adversarial loss is minimized, resulting in a pre-trained local prediction model, including: The pre-built local cue vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data, including: The pre-built local cue vector and local historical power supply data are concatenated to obtain the training input data, as follows: First, regarding historical power supply data Set a learnable cue vector. The two data points are concatenated and used together as the training input data for the local prediction model. ,in Represents the real number field. This indicates the time step length of historical power supply data. This represents the length of the learnable cue vector. This indicates a concatenation operation. Note that the cue vector needs to be concatenated before the historical power supply data to ensure that the local prediction model can use the temporal continuity of the power supply data to predict future power supply data.
[0056] Local prediction model: Maps training input data in the real number domain to a high-dimensional feature space and constructs time dependencies to predict power supply data for a future period.
[0057] Specifically, for training input data Using the embedding model Mapped to high-dimensional feature vectors ,as follows:
[0058] in, Let be the dimension of the feature space. This refers to matrix multiplication.
[0059] Then, time dependencies are constructed using a time-domain model. , to high-dimensional feature vector Transform into temporal feature vectors that capture time dependencies ,as follows:
[0060] Finally, the decoding model is used. , time series feature vector Mapped to the output space, the predicted power supply data is obtained. ,as follows:
[0061] in, The time step length for predicting power supply data.
[0062] Based on the predicted power supply data, a trained local discriminant model is used to determine the category probability corresponding to the historical predicted power supply data. The process is as follows: The principle here is that during adversarial training, the local discriminative model is made to distinguish as much as possible whether the input data is predicted or real, and the local prediction model is made to deceive the discriminative model as much as possible. This makes the local prediction model more adaptable to the distribution of local data, thereby improving the accuracy of prediction.
[0063] Specifically, the local discriminant model It is a binary classifier that takes its input predicted power supply data Mapping to logical features
[0064] in, , For the logical features corresponding to category 1, For the logical features corresponding to category 2, The input to the discriminator is the predicted power supply data output by the local prediction model. .
[0065] Then, the discriminant model uses the softmax function to obtain the confidence score of the class, as shown in the following formula:
[0066] in, , The confidence score for category 1. Here is the confidence level corresponding to category 2, where It is the natural base.
[0067] Without loss of generality, if we define category 1 as model input derived from real power supply data, then... To determine the probability that the model input comes from real power supply data; Category 2 is where the model input comes from a predictive model, then... The discriminant model receives probabilities from the prediction model as input. The final output of the discriminant model is... Used for subsequent training.
[0068] It is important to note the model parameters here. , , , It is not a deterministic linear mapping, but rather a general model representation that can achieve the effect of dimension mapping. In specific implementations, it can be a linear mapping MLP, a convolutional neural network CNN, a recurrent neural network RNN, a long short-term memory network LSTM, a Transformer, and other network structures.
[0069] Iterative training continues until the sum of the prediction loss and the adversarial loss is minimized, resulting in a well-trained local prediction model. The prediction training process calculates and optimizes the prediction loss for all samples, as follows:
[0070] in, Use it to calculate the distance between two inputs. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample Indicates the first Historical measured power supply data for each sample prediction period.
[0071] The adversarial loss for all samples is calculated and optimized as follows:
[0072] Optimizing this loss will make The larger the value, the more it forces the predictive model to deceive the discriminative model.
[0073] The gradient of the parameters of the trained local prediction model is uploaded to the central server.
[0074] Global Prediction Model: The model architecture is consistent with the local prediction model, the difference being in the model's input. When used in the local prediction model, the input includes a cue vector (time step length is...). ) and historical power supply data (time step length is When using the global prediction model, the input only includes historical power supply data (time step length is...). ).
[0075] Step S3: The central server aggregates the parameter gradients from each collaborator, averages them to obtain the average parameter gradient, and sends it back to each collaborator. Simultaneously, it uses the average parameter gradient to update the parameters of the global prediction model, including: The central server aggregates the parameter gradients of each partner and then averages them to obtain the average parameter gradient. The central server simultaneously updates the parameters of the global prediction model using the average parameter gradient.
[0076] Specifically, let the first... The first partner The parameters of the local prediction model in the round of iterations are , No. The gradient of the local prediction model in rounds of iterations is The gradient after federated aggregation is:
[0077] Therefore, the first after federal aggregation The parameters of the iterative local prediction model are:
[0078] in, For learning rate, This represents the number of partners.
[0079] Note that only the parameter gradients of the local prediction model are uploaded and aggregated here, not the parameter gradients of the local discriminant model. The optimization methods used here can include stochastic gradient descent (SGD), adaptive moment estimation (Adam), etc. Its distance metric function... Mean squared error (MSE) and mean absolute error (MAE) are distance metrics that can be used. The learning rate... Generally set to .
[0080] The aggregation algorithm can employ, but is not limited to, weighted averaging (FedAvg), optimization-based FedProx, or a robust FedAdversarial mechanism to mitigate the impact of inconsistent data distribution. In implementation, the central server can utilize secure multi-party computation (SMC) or homomorphic encryption to encrypt and aggregate uploaded parameters, ensuring the privacy of data across nodes is not compromised. The aggregated global model parameters are then distributed to each node for the next round of iterative training, enabling continuous model optimization. Through this design, the federated training module achieves the collaborative evolution of multi-regional power supply prediction models, significantly improving the model's generalization ability and robustness while maintaining data privacy.
[0081] Step S4: Each partner receives the average parameter gradient and updates the parameters of its local prediction model; Step S5: Periodic cyclic federated training steps S2-S4, each partner uses the updated local prediction model to make predictions based on real-time power supply data, and obtains future predicted power supply data.
[0082] Using a locally predicted model trained in a federated manner, inference predictions are made on real-time power supply data; the prediction input is usually a multi-dimensional power supply feature sequence over a past period (such as the past 30 minutes or 1 hour), and the output is the power supply prediction result for several future time steps.
[0083] In practical applications, the local prediction model can adopt a sliding window mechanism to ensure the timeliness and continuity of the prediction results. The output results can be divided into multiple scale modes such as short-term prediction (5-15 minutes), medium-term prediction (hourly level) and daily level prediction to meet the needs of different scheduling levels.
[0084] The forecast results can be used by the dispatch center for grid load regulation, power generation plan optimization, and early warning of abnormal power supply conditions, realizing intelligent power supply forecasting and management. In different implementation scenarios, this embodiment can be extended to distribution network load forecasting, renewable energy output forecasting, and regional energy management, and has good scalability and economic benefits.
[0085] Example 2 This embodiment provides a power supply prediction system based on federated cueing adversarial learning, including numerous collaborators and a central server. The training and prediction process of each collaborator and the central server is as follows: The central server initializes the parameters of the global prediction model and the local prediction models in each partner. Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model and uploads the parameter gradient of the local prediction model to the central server. The central server aggregates the parameter gradients from each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Each partner receives the average parameter gradient and updates the parameters of its local prediction model. Periodic cyclical federated training involves each partner using updated local prediction models based on real-time power supply data to obtain future predicted power supply data.
[0086] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A power supply prediction method based on federated prompting adversarial learning, characterized in that, include: The central server initializes the parameters of the global prediction model and the local prediction models in each partner. Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model and uploads the parameter gradient of the local prediction model to the central server. The central server aggregates the parameter gradients from each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Each partner receives the average parameter gradient and updates the parameters of its local prediction model. Periodic cyclical federated training involves each partner using updated local prediction models based on real-time power supply data to obtain future predicted power supply data.
2. The power supply prediction method based on federated prompting adversarial learning as described in claim 1, characterized in that, Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model, and then uploads the parameter gradients of the local prediction model to the central server, including: An adversarial network is formed by using a local prediction model as a generator and a local discriminant model as a discriminant. The parameters of the local prediction model are fixed. The local discriminant model is iteratively trained using the pre-built prompt vector, local historical power supply data, and historical measured power supply data for the prediction period as training data until the discriminant loss is minimized, thus obtaining the trained local discriminant model. The parameters of the pre-trained local discriminative model are fixed. The local prediction model is iteratively trained using the pre-built local cue vector and local historical power supply data as training data until the sum of the prediction loss and adversarial loss is minimized, thus obtaining the pre-trained local prediction model. The gradient of the parameters of the trained local prediction model is uploaded to the central server.
3. The power supply prediction method based on federated prompting adversarial learning as described in claim 2, characterized in that, The parameters of the fixed local prediction model are used as training data, with pre-built local cue vectors, local historical power supply data, and historical measured power supply data for the prediction period. The local discrimination model is iteratively trained until the discrimination loss is minimized, resulting in a trained local discrimination model, including: The local pre-built prompt vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data. Based on the predicted power supply data and the historical measured power supply data for the predicted time period, a local discrimination model is used to make a discrimination, and the category probability corresponding to the historical predicted power supply data and the category probability corresponding to the historical measured power supply data are output. Iterate through the training process until the discrimination loss is minimized to obtain a well-trained local discrimination model.
4. The power supply prediction method based on federated prompting adversarial learning as described in claim 3, characterized in that, A local prediction model is trained based on the training input data to obtain predicted power supply data, including: For the training input data, an embedding model is used to map it into a high-dimensional feature vector; Using a time-domain model, high-dimensional feature vectors are transformed into time-series feature vectors that capture time dependencies; Using a decoding model, the time-series feature vector Mapping to the output space yields the predicted power supply data.
5. The power supply prediction method based on federated prompting adversarial learning as described in claim 2, characterized in that, With fixed parameters of the pre-trained local discriminative model, and using pre-built local cue vectors and local historical power supply data as training data, the local prediction model is iteratively trained until the sum of the prediction loss and adversarial loss is minimized, resulting in a pre-trained local prediction model, including: The local pre-built prompt vector and local historical power supply data are concatenated to obtain training input data. Based on the training input data, a local prediction model is trained to obtain predicted power supply data. Based on the predicted power supply data, a trained local discrimination model is used to make a discrimination and obtain the category probability corresponding to the historical predicted power supply data. Iterate through the training process until the sum of the prediction loss and the adversarial loss is minimized, resulting in a well-trained local prediction model.
6. The power supply prediction method based on federated prompting adversarial learning as described in claim 2, characterized in that, The predicted loss ,as follows: in, Use it to calculate the distance between two inputs. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample Indicates the first Historical measured power supply data for each sample prediction period.
7. The power supply prediction method based on federated prompting adversarial learning as described in claim 2, characterized in that, The resistance loss ,as follows: in, This represents the confidence level of the discriminative model, where the output is in the range [0,1]. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample.
8. The power supply prediction method based on federated prompting adversarial learning as described in claim 2, characterized in that, The discriminant loss ,as follows: in, This represents the confidence level of the discriminative model, where the output is in the range [0,1]. Indicates the number of samples. Indicates the local prediction model. Indicates the first Historical power supply data for each sample Indicates the first Historical measured power supply data for each sample prediction period.
9. The power supply prediction method based on federated prompting adversarial learning as described in claim 1, characterized in that, The global prediction model and the local prediction model are the same model.
10. A power supply prediction system based on federated prompting adversarial learning, characterized in that, Including numerous partners and a central server, the training and prediction process for each partner and the central server is as follows: The central server initializes the parameters of the global prediction model and the local prediction models in each partner. Each partner uses local historical power supply data and pre-built cue vectors to train a local prediction model and uploads the parameter gradient of the local prediction model to the central server. The central server aggregates the parameter gradients from each partner and averages them to obtain the average parameter gradient, which is then sent back to each partner. At the same time, the parameters of the global prediction model are updated using the average parameter gradient. Each partner receives the average parameter gradient and updates the parameters of its local prediction model. Periodic cyclical federated training involves each partner using updated local prediction models based on real-time power supply data to obtain future predicted power supply data.