Small-amount data fine tuning and self-repairing generative model compression method for specific task of power system

Through a small amount of data fine-tuning and self-repair generation model compression method, combined with knowledge distillation and model compression technology, situation-aware GAN, self-repair GAN and counterfactual GAN ​​are used to solve the problem that the power system model is difficult to operate efficiently and quickly adapt to environmental changes in resource-constrained environments, and the stability and reliability guarantee of the power system is achieved.

CN119830968APending Publication Date: 2025-04-15CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411605238.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently run power system models on resource-constrained edge devices or embedded systems, and traditional large-scale training models are difficult to quickly adapt to changes and abnormal situations in the power system environment.

Method used

A small amount of data fine-tuning and self-repair generation model compression method is adopted to reduce computing requirements through knowledge distillation and model compression technology, and combine situation-aware GAN, self-repair GAN and counterfactual GAN ​​to adjust and update the model in real time to deal with environmental changes and abnormal data.

Benefits of technology

It realizes efficient operation of the power system model in resource-constrained environments and quickly adapts to environmental changes, ensuring the stability and reliability of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119830968A_ABST
    Figure CN119830968A_ABST
Patent Text Reader

Abstract

The invention discloses a small-amount data fine tuning and self-repairing generative model compression method for specific tasks of an electric power system, which reduces calculation requirements through knowledge distillation and model compression technologies and enables an electric power system model to operate efficiently in a resource-limited environment. Knowledge distillation extracts core knowledge of a large model and migrates the core knowledge to a small model, then pruning and quantification are combined, the parameter quantity is optimized, and lightweight deployment is ensured. Meanwhile, through context awareness, self-repairing and anti-fact GAN, the model generation and adaptive capacity is further enhanced. The context-aware GAN can adjust a model in real time to cope with environmental changes, and the self-repairing GAN generates a replacement sample when data is abnormal, so that the data input quality is ensured; the anti-factual GAN simulates different strategies in a hypothesis situation, and provides support for risk assessment and optimization. Through the mechanism, the model maintains high-precision prediction and response in various scenes, and efficient and stable operation of a power system is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of model compression, and in particular, relates to a method for compressing a model generated by fine-tuning and self-repairing a small amount of data for a specific task of an electric power system. Background Art

[0002] In the power system, in order to improve the prediction accuracy and operation efficiency of the model, large-scale data sets containing a large amount of historical data and operation data are usually used for training to capture the changing laws of power load and the complex characteristics of equipment operation. However, this method has very high requirements for computing resources, especially when facing large-scale data and deep learning models. Both the training and reasoning processes require high-performance computing devices and sufficient storage resources, which makes it difficult for the model to run efficiently on resource-constrained edge devices or embedded systems. In addition, since the operating environment and load conditions of the power system are dynamically changing, traditional large-scale training models are often difficult to quickly adapt to these sudden environmental conditions or sudden abnormal conditions, such as climate change, sudden load increase, or equipment failure. Traditional methods often rely on periodic retraining of models to cope with environmental changes, but this method is not only time-consuming and computationally expensive, but also unable to achieve immediate response in sudden situations. Therefore, it lacks the ability to flexibly process and quickly respond to real-time environmental changes and abnormal data, and it is difficult to ensure the stability and reliability of the power system.

[0003] In view of this, the present invention is proposed. Summary of the invention

[0004] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a method for compressing a small amount of data fine-tuning and self-repairing generation model for specific tasks in a power system, thereby solving the problems raised in the above-mentioned background technology.

[0005] In order to solve the above technical problems, the basic concept of the technical solution adopted by the present invention is:

[0006] A method for compressing a model for fine-tuning and self-repairing generation of a small amount of data for a specific task in a power system, comprising the following steps:

[0007] S1: Use historical data of the power system to train a basic large model and extract key features. Then transfer the knowledge of the large model to the small model and use structured pruning and quantization techniques to reduce model parameters.

[0008] After completing the model compression, S2 uses a small amount of task-specific data to fine-tune the small model to optimize its adaptability and prediction ability in different scenarios;

[0009] S3 monitors environmental variables in power system operation. If it detects that external conditions deviate from the normal state, it automatically collects data fragments related to the current changing situation and uses them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model.

[0010] The S4 real-time monitoring module detects deviations in device data. When it detects that sensor data or device status exceeds a set threshold, it records abnormal samples and triggers the self-healing GAN. The self-healing GAN uses abnormal data and normal operation history as input to generate replacement samples to supplement or replace abnormal data.

[0011] S5 creates several hypothetical scenarios based on risk assessment requirements and historical operating data. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data to simulate the operating effects of the power system under different strategies, evaluate the effects of the operating strategies, and adjust the control strategies based on the simulation results.

[0012] S6 feeds back the data generated by context-aware, self-healing and counterfactual GANs synchronously with real-time data to the model for dynamic optimization, and automatically initiates new fine-tuning and sample generation processes when long-term trend changes are detected.

[0013] Optionally, S1 uses historical data of the power system to train a basic large model, extracts key features, and then transfers the knowledge of the large model to the small model through knowledge distillation, and uses structured pruning and quantization techniques to reduce model parameters. The steps are as follows:

[0014] S101: Use the historical load data and equipment status data of the power system to train the basic large model, extract the data time series characteristics, nonlinear relationships and power equipment operation rules, and its expression is: Among them, L seq is the loss of time series prediction, N is the number of samples, y t is the actual load or state value, x t is the input data, f(x t , θ) is the predicted output of the model, and θ is the parameter of the model;

[0015] S102: After the large model completes training based on the historical data of the power system, it generates soft labels for the input samples. Subsequently, the small model receives the same input samples, calculates its own output probability, and compares it with the soft labels of the teacher model. Finally, during the training process, the small model continuously optimizes its own weights and gradually learns the reasoning logic of the teacher model.

[0016] S103: After the knowledge transfer is completed, the structured pruning technology is used on the small model to remove neurons, channels or layers with low computational contribution. Then, the pruning algorithm identifies redundant filters and deletes them. Then, based on the pruned model, the formula Convert the model’s floating-point weights and activation values ​​to low-bit representations, where W quantized is the quantized weight, W pruned is the pruned weight matrix, Δ is the quantization step size, and round() is rounded to the nearest integer.

[0017] Optionally, S102 also designs a distillation loss function during the training process to narrow the output gap between the small model and the teacher model. The loss combines the soft label loss with the cross entropy loss of the true label. At the same time, a temperature parameter is introduced during the distillation process to adjust the probability distribution of the teacher model output. When the temperature is high, the probability distribution of the teacher model output is smoother.

[0018] Optionally, after completing model compression, the steps to fine-tune the small model using a small amount of data for a specific task to optimize its adaptability and predictive ability in different scenarios are:

[0019] A small amount of relevant data is extracted from the specific tasks of the power system and filtered and labeled according to the target task to ensure that the data covers the main features of the target scenario. Then, the compressed basic small model is used as the initial state of the fine-tuning model, and the weights and parameters learned in the previous model training are loaded. Subsequently, the small model is trained using the fine-tuning dataset, and the prediction ability of the model in a specific scenario is evaluated through the validation set. The model performance is dynamically monitored during the training process. If an overfitting trend is detected, the training is stopped in advance to optimize the results.

[0020] Optionally, S3 monitors environmental variables in power operation during power system operation. If it detects that external conditions deviate from the normal state, it automatically collects data fragments related to the current change situation and uses them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model. The steps are:

[0021] S301: Real-time monitoring of environmental variables in the power system. If it is detected that the external conditions exceed the set threshold, the data fragments related to the change situation are automatically collected, and the time, location and equipment status of the change are recorded. Then, the relevant data fragments are used as input to initialize the generator and discriminator of the context-aware GAN;

[0022] S302: The context-aware GAN generator generates preliminary samples according to the characteristics of the input data, and the context-aware GAN discriminator screens the generated samples to ensure that the output samples meet the current context characteristics;

[0023] S303: The context-aware GAN generates sample data that conforms to the current context through repeated training. These samples capture the operating characteristics of the power system in a specific environment. The generated samples are used to calibrate the fine-tuned model, and its expression is: Among them, L calibrate : Mean squared error loss for model calibration, y i is the target value of the actual operating data, To fine-tune the model's predicted output for the generated samples, m is the number of generated samples.

[0024] Optionally, the S4 real-time monitoring module detects deviations in device data. When it detects that sensor data or device status exceeds a set threshold, it records abnormal samples and triggers the self-healing GAN. The self-healing GAN takes abnormal data and normal operation history as input, and generates replacement samples to supplement or replace abnormal data in the following steps:

[0025] S401: Through the sensor and equipment monitoring module, the operation data in the power system is continuously detected. When the monitored data exceeds the set normal threshold or deviates from the normal trend, the abnormal sample and its related time, location and equipment information are recorded. Then, the detected abnormal data is marked and compared with the normal operation data to confirm the source and nature of the deviation. Once the abnormality is confirmed, the self-healing GAN is immediately triggered. Among them, the self-healing GAN model takes the abnormal data and the normal operation history as input to prepare for the generation of replacement samples. Its expression is: Among them, E deυ : The degree of deviation of abnormal data, is the i-th observation data (abnormal sample), is the i-th corresponding normal data point, and n is the number of samples;

[0026] S402: When replacing samples, the generator of the repair GAN model generates preliminary replacement samples according to the historical operating rules, and the discriminator of the repair GAN model simultaneously evaluates whether the generated samples match the normal data. When the generator and the discriminator are consistent, the replacement samples output by GAN are used to replace abnormal data or fill data gaps. Finally, the replacement samples are fed back to the real-time monitoring module of the power system and used to calibrate the fine-tuned prediction model.

[0027] Optionally, S5 creates several hypothetical scenarios based on risk assessment requirements and historical operation data. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data for simulating the operation effects of the power system under different strategies, evaluating the effects of the operation strategies, and adjusting the control strategies according to the simulation results. The steps are as follows:

[0028] S501: Based on the risk assessment requirements and historical operation data of the power system, potential risk factors are identified and several specific hypothetical scenarios are generated. After the hypothetical scenarios are created, these hypothetical conditions and historical operation data are used as input to initialize the counterfactual GAN ​​model;

[0029] S502: The generator of the counterfactual GAN ​​model generates virtual sample data matching the hypothetical scenario based on these inputs, and the discriminator of the counterfactual GAN ​​model screens these samples to ensure that they meet the hypothetical conditions;

[0030] S503: According to the output counterfactual GAN ​​of the generator and the discriminator, a virtual sample that conforms to the hypothetical scenario is generated, and the operation effect of the power system is simulated under different strategies. The simulation results of different strategies are compared to identify the advantages and disadvantages of each strategy in a specific scenario, and its effect is quantified according to the evaluation index. The current control strategy is optimized according to the simulation and evaluation results, and the optimized strategy is applied to the actual power system. The expression is: Among them, L sim : The mean square error between the simulation results and the actual results, is the output of the virtual sample under the jth strategy, is the output of the actual system under the same conditions, and m is the number of strategies.

[0031] Optionally, the data generated by the context-aware, self-healing, and counterfactual GANs are fed back to the model synchronously with the real-time data for dynamic optimization. When a long-term trend change is detected, the steps to automatically start a new fine-tuning and sample generation process are:

[0032] The sample data generated by the context-aware GAN, self-healing GAN, and counterfactual GAN ​​are synchronously fed back to the fine-tuned power system model with the real-time operation data. Then, the real-time monitoring data X t With historical reference data X h Integration, calculate the error at the current time t, the expression is: Among them, E t represents the mean square error X at time t t,i is the i-th real-time sample, X h,i is the corresponding historical data sample, n is the number of samples;

[0033] Adopt an adaptive learning rate strategy to dynamically adjust the model weight according to the error and set the current weight to W t , then the update rule is: Among them, W t+1 is the updated weight, η is the dynamic learning rate, and then, by monitoring the error trend, the learning rate update formula based on the error change rate is adopted: Based on long-term trend analysis, automatically adjust the model's rules or strategies, where η t is the current learning rate, and α is the adjustment coefficient.

[0034] Optionally, historical data, real-time environmental data, and abnormal data in the power system are collected, and corresponding training data sets are constructed according to situational awareness, self-repair, and hypothetical scenarios;

[0035] Initialize the generator parameters of context-aware, self-healing, and counterfactual GANs. The generator contains multiple convolutional layers, activation functions, and dropout layers. The generator generates initial samples based on input noise and context features, and adjusts the generator weights to gradually approximate the generated samples to the real data distribution;

[0036] Initialize the discriminator parameters of context-aware, self-repairing, and counterfactual GANs. The discriminator contains multiple convolutional layers, activation functions, and dropout layers. The discriminator receives real data and data generated by the generator and compares them. Through adversarial training, the discriminator can accurately distinguish between generated samples and real samples.

[0037] Combining the loss function L of the generator and the discriminator GAN (G, D), continuously optimizing the parameters of the generator and the discriminator.

[0038] Optionally, the generator and discriminator of the context-aware GAN are initialized based on the real-time environmental data of the power system. The generator takes the current context data as input to generate samples that match the actual environment, and the discriminator verifies the authenticity of the generated samples through the adversarial loss function of formula (1);

[0039] After detecting abnormal data in the power system, the generator of the self-repairing GAN generates replacement samples based on the normal operating data, and the discriminator determines whether the replacement samples are consistent with the normal data distribution according to formula (1);

[0040] According to the risk assessment requirements of the power system, a counterfactual GAN ​​is used to create a hypothetical scenario. The generator accepts the conditional input of the hypothetical scenario and generates virtual samples that match the scenario. The discriminator uses formula (1) to screen samples that meet the hypothetical conditions.

[0041]

[0042] Among them, L GAN (G, D) is the adversarial loss function, which is the loss between the generator G and the discriminator D. G is the generator model, D is the discriminator model, x is a real data sample, which comes from the actual observation data or historical data in the power system, representing the normal or expected state, and p data (x) is the real data distribution, z is the random input noise of the generator, p z(z) is the noise distribution, D(x): the score or probability of the discriminator for the input x.

[0043] After adopting the above technical solution, the present invention has the following beneficial effects compared with the prior art. Of course, any product implementing the present invention does not necessarily need to achieve all the advantages described below at the same time:

[0044] By reducing computing requirements through knowledge distillation and model compression technology, the power system model can operate efficiently in a resource-constrained environment. Knowledge distillation extracts the core knowledge of the large model and migrates it to the small model. Combined with pruning and quantization, the number of parameters is optimized to ensure lightweight deployment. At the same time, through context-awareness, self-healing and counterfactual GAN, the model generation and adaptation capabilities are further enhanced. Context-aware GAN can adjust the model in real time to cope with environmental changes, self-healing GAN generates alternative samples when data is abnormal to ensure the quality of data input; counterfactual GAN ​​simulates different strategies in hypothetical scenarios to provide support for risk assessment and optimization. Through this mechanism, the model maintains high-precision prediction and response in various scenarios to ensure efficient and stable operation of the power system.

[0045] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The drawings described below are only some embodiments. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0047] In the figure:

[0048] Figure 1 Schematic diagram of the model compression method flow.

[0049] It should be noted that these drawings and textual descriptions are not intended to limit the conceptual scope of the present invention in any way, but are intended to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0050] The present invention will now be described in further detail with reference to the accompanying drawings.

[0051] See also Figure 1 As shown, in this embodiment, a method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task of a power system is provided, comprising the following steps:

[0052] S1: Use historical data of the power system to train a basic large model and extract key features. Then transfer the knowledge of the large model to the small model and use structured pruning and quantization techniques to reduce model parameters.

[0053] S2: After model compression, fine-tune the small model using a small amount of task-specific data to optimize its adaptability and predictive ability in different scenarios;

[0054] S3: Monitor environmental variables in power operation during power system operation. If it detects that external conditions deviate from the normal state, automatically collect data fragments related to the current changing situation and use them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model.

[0055] S4: The real-time monitoring module detects deviations in device data. When it detects that sensor data or device status exceeds a set threshold, it records abnormal samples and triggers the self-healing GAN. The self-healing GAN takes abnormal data and normal operation history as input to generate replacement samples to supplement or replace abnormal data.

[0056] S5: Based on risk assessment requirements and historical operating data, several hypothetical scenarios are created. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data to simulate the operating effects of the power system under different strategies, evaluate the effects of the operating strategies, and adjust the control strategies based on the simulation results.

[0057] S6: The data generated by context-aware, self-healing, and counterfactual GANs are synchronously fed back to the model with real-time data for dynamic optimization. When long-term trend changes are detected, new fine-tuning and sample generation processes are automatically initiated.

[0058] In this embodiment, S1 uses the historical data of the power system to train the basic large model, extracts key features, and then transfers the knowledge of the large model to the small model through knowledge distillation, and uses structured pruning and quantization technology to reduce the model parameters. The steps are:

[0059] S101: Use the historical load data and equipment status data of the power system to train the basic large model, extract the data time series characteristics, nonlinear relationships and power equipment operation rules, and its expression is: Among them, L seq is the loss of time series prediction, N is the number of samples, y t is the actual load or state value, x t is the input data, f(x t , θ) is the predicted output of the model, and θ is the parameter of the model;

[0060] S102: After the large model completes training based on the historical data of the power system, it generates soft labels for the input samples. Subsequently, the small model receives the same input samples, calculates its own output probability, and compares it with the soft labels of the teacher model. Finally, during the training process, the small model continuously optimizes its own weights and gradually learns the reasoning logic of the teacher model.

[0061] S103: After the knowledge transfer is completed, the structured pruning technology is used on the small model to remove neurons, channels or layers with low computational contribution. Then, the pruning algorithm identifies redundant filters and deletes them. Then, based on the pruned model, the formula Convert the model’s floating-point weights and activation values ​​to low-bit representations, where W quantized is the quantized weight, W pruned is the pruned weight matrix, Δ is the quantization step size, and round() is rounded to the nearest integer.

[0062] In this embodiment, S102 also designs a distillation loss function during the training process to narrow the output gap between the small model and the teacher model. This loss combines the soft label loss with the cross entropy loss of the true label. At the same time, a temperature parameter is introduced in the distillation process to adjust the probability distribution of the teacher model output. When the temperature is high, the probability distribution of the teacher model output is smoother.

[0063] In this embodiment, after completing the model compression, the steps of fine-tuning the small model using a small amount of data for a specific task to optimize its adaptability and prediction ability in different scenarios are as follows:

[0064] A small amount of relevant data is extracted from the specific tasks of the power system and filtered and labeled according to the target task to ensure that the data covers the main features of the target scenario. Then, the compressed basic small model is used as the initial state of the fine-tuning model, and the weights and parameters learned in the previous model training are loaded. Subsequently, the small model is trained using the fine-tuning dataset, and the prediction ability of the model in a specific scenario is evaluated through the validation set. The model performance is dynamically monitored during the training process. If an overfitting trend is detected, the training is stopped in advance to optimize the results.

[0065] In this embodiment, S3 monitors environmental variables in power operation during power system operation. If it detects that external conditions deviate from the normal state, it automatically collects data fragments related to the current changing situation and uses them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model. The steps are:

[0066] S301: Real-time monitoring of environmental variables in the power system. If it is detected that the external conditions exceed the set threshold, the data fragments related to the change situation are automatically collected, and the time, location and equipment status of the change are recorded. Then, the relevant data fragments are used as input to initialize the generator and discriminator of the context-aware GAN;

[0067] S302: The context-aware GAN generator generates preliminary samples according to the characteristics of the input data, and the context-aware GAN discriminator screens the generated samples to ensure that the output samples meet the current context characteristics;

[0068] S303: The context-aware GAN generates sample data that conforms to the current context through repeated training. These samples capture the operating characteristics of the power system in a specific environment. The generated samples are used to calibrate the fine-tuned model, and its expression is: Among them, L calibrate : Mean squared error loss for model calibration, y i is the target value of the actual operating data, To fine-tune the model's predicted output for the generated samples, m is the number of generated samples.

[0069] In this embodiment, the S4 real-time monitoring module detects the deviation of the equipment data. When it is detected that the sensor data or the equipment status exceeds the set threshold, the abnormal sample is recorded and the self-repairing GAN is triggered. The self-repairing GAN takes the abnormal data and the normal operation history as input, and generates a replacement sample to supplement or replace the abnormal data in the following steps:

[0070] S401: Through the sensor and equipment monitoring module, the operation data in the power system is continuously detected. When the monitored data exceeds the set normal threshold or deviates from the normal trend, the abnormal sample and its related time, location and equipment information are recorded. Then, the detected abnormal data is marked and compared with the normal operation data to confirm the source and nature of the deviation. Once the abnormality is confirmed, the self-healing GAN is immediately triggered. Among them, the self-healing GAN model takes the abnormal data and the normal operation history as input to prepare for the generation of replacement samples. Its expression is: Among them, E deυ is the degree of deviation of abnormal data, is the i-th observation data (abnormal sample), is the i-th corresponding normal data point, and n is the number of samples;

[0071] S402: When replacing samples, the generator of the repair GAN model generates preliminary replacement samples according to the historical operating rules, and the discriminator of the repair GAN model simultaneously evaluates whether the generated samples match the normal data. When the generator and the discriminator are consistent, the replacement samples output by GAN are used to replace abnormal data or fill data gaps. Finally, the replacement samples are fed back to the real-time monitoring module of the power system and used to calibrate the fine-tuned prediction model.

[0072] In this embodiment, S5 creates several hypothetical scenarios based on risk assessment requirements and historical operation data. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data for simulating the operation effects of the power system under different strategies, evaluating the effects of the operation strategies, and adjusting the control strategies according to the simulation results.

[0073] S501: Based on the risk assessment requirements and historical operation data of the power system, potential risk factors are identified and several specific hypothetical scenarios are generated. After the hypothetical scenarios are created, these hypothetical conditions and historical operation data are used as input to initialize the counterfactual GAN ​​model;

[0074] S502: The generator of the counterfactual GAN ​​model generates virtual sample data matching the hypothetical scenario based on these inputs, and the discriminator of the counterfactual GAN ​​model screens these samples to ensure that they meet the hypothetical conditions;

[0075] S503: According to the output counterfactual GAN ​​of the generator and the discriminator, a virtual sample that conforms to the hypothetical scenario is generated, and the operation effect of the power system is simulated under different strategies. The simulation results of different strategies are compared to identify the advantages and disadvantages of each strategy in a specific scenario, and its effect is quantified according to the evaluation index. The current control strategy is optimized according to the simulation and evaluation results, and the optimized strategy is applied to the actual power system. The expression is: Among them, L sim : The mean square error between the simulation results and the actual results, is the output of the virtual sample under the jth strategy, is the output of the actual system under the same conditions, and m is the number of strategies.

[0076] In this embodiment, the data generated by the context-aware, self-healing and counterfactual GANs are synchronously fed back to the model with the real-time data for dynamic optimization. When a long-term trend change is detected, the steps of automatically starting a new fine-tuning and sample generation process are as follows:

[0077] The sample data generated by the context-aware GAN, self-healing GAN, and counterfactual GAN ​​are synchronously fed back to the fine-tuned power system model with the real-time operation data. Then, the real-time monitoring data X t With historical reference data X h Integration, calculate the error at the current time t, the expression is: Among them, E t represents the mean square error X at time t t,i is the i-th real-time sample, X h,i is the corresponding historical data sample, n is the number of samples;

[0078] Adopt an adaptive learning rate strategy to dynamically adjust the model weight according to the error and set the current weight to W t , then the update rule is: Among them, W t+1 is the updated weight, η is the dynamic learning rate, and then, by monitoring the error trend, the learning rate update formula based on the error change rate is adopted: Based on long-term trend analysis, automatically adjust the model's rules or strategies, where η t is the current learning rate, and α is the adjustment coefficient. When the error increases, η increases to speed up learning; when the error decreases, η decreases to avoid overfitting.

[0079] In this embodiment, historical data, real-time environmental data and abnormal data in the power system are collected, and corresponding training data sets are constructed according to situational awareness, self-repair and hypothetical scenarios;

[0080] Initialize the generator parameters of context-aware, self-healing, and counterfactual GANs. The generator contains multiple convolutional layers, activation functions, and dropout layers. The generator generates initial samples based on input noise and context features, and adjusts the generator weights to gradually approximate the generated samples to the real data distribution;

[0081] Initialize the discriminator parameters of context-aware, self-repairing, and counterfactual GANs. The discriminator contains multiple convolutional layers, activation functions, and dropout layers. The discriminator receives real data and data generated by the generator and compares them. Through adversarial training, the discriminator can accurately distinguish between generated samples and real samples.

[0082] Combining the loss function L of the generator and the discriminator GAN (G, D), continuously optimize the parameters of the generator and the discriminator. The goal of the generator is to maximize the probability of the discriminator's "misjudgment" of the generated samples, while the goal of the discriminator is to minimize the probability of misjudgment of real samples and generated samples, so that the samples generated by the generator gradually approach the real data distribution.

[0083] In this embodiment, the generator and discriminator of the context-aware GAN are initialized based on the real-time environmental data of the power system. The generator takes the current context data as input to generate samples that match the actual environment, and the discriminator verifies the authenticity of the generated samples through the adversarial loss function of formula (1);

[0084] After detecting abnormal data in the power system, the generator of the self-repairing GAN generates replacement samples based on the normal operating data, and the discriminator determines whether the replacement samples are consistent with the normal data distribution according to formula (1);

[0085] According to the risk assessment requirements of the power system, a counterfactual GAN ​​is used to create a hypothetical scenario. The generator accepts the conditional input of the hypothetical scenario and generates virtual samples that match the scenario. The discriminator uses formula (1) to screen samples that meet the hypothetical conditions.

[0086]

[0087] Among them, L GAN (G, D): Adversarial loss function, which is the loss between the generator G and the discriminator D. This loss measures the similarity between the generated samples and the real data in statistical characteristics. In GAN, the generator and the discriminator optimize the loss function through adversarial means, so that the generated samples are as close to the real data distribution as possible. G is the generator model. It accepts random noise or conditional input and outputs a generated sample. The goal of the generator is to maximize the probability of "misjudgment" of the discriminator on the generated samples, that is, the generator hopes that the generated samples can deceive the discriminator. D is the discriminator model. It receives real data or generated samples as input and outputs a probability value to determine whether the input data comes from the real distribution. The goal of the discriminator is to maximize the correct identification of real data while minimizing the misjudgment of generated data. x is a real data sample, which comes from actual observation data or historical data in the power system and represents a normal or expected state. The real data provides a benchmark for comparison between the generator and the discriminator. p data (x) is the real data distribution. It refers to the probability distribution of the actual data under specific conditions, which is used to provide a real distribution reference for the discriminator so that the discriminator can distinguish between the generated samples and the real samples. z is the random input noise of the generator. It comes from a predefined noise distribution (such as Gaussian distribution or uniform distribution) and is used to provide input to the generator to generate new samples. The noise input enables the generator to generate diverse samples and increase the flexibility of GAN. z (z) is the noise distribution. This distribution defines the probability distribution of the generator input noise, which is generally a standard Gaussian distribution or uniform distribution, which is used to ensure that the generated samples have a certain diversity. D(x) is the score or probability of the discriminator for the input x, representing the possibility that the input data is real data. The discriminator hopes to output a higher score (close to 1) for the real data x and a lower score (close to 0) for the generated data G(z). D(G(z)) is the discriminator's score for the generated sample G(z), representing the possibility that the input is a generated sample. The goal of the discriminator is to make the score of the generated sample as low as possible to achieve accurate distinction between real data and generated data. Specifically, the application of formula (1) in context-aware GAN:

[0088] In the context-aware GAN, the generator G generates samples under the current environmental conditions and uses the discriminator D to determine whether the sample conforms to the current actual situation characteristics.

[0089] The goal of the discriminator is to distinguish the generated sample G(z) from the real situation data x. The first term in the formula Represents the accuracy of the discriminator's judgment on the real situation data.

[0090] Item 2 It means that the generator tries to generate samples close to the real situation, so that the discriminator cannot easily distinguish them.

[0091] Application of formula (1) in self-repairing GAN:

[0092] In the self-healing GAN, the generator G receives abnormal data and normal data history and generates samples to replace the abnormal data. The discriminator D is responsible for judging whether the generated replacement samples conform to the normal data distribution.

[0093] The discriminator hopes to be able to identify the difference between abnormal and normal data, so Used to judge normal data, It is used to optimize the generator to generate samples that match normal data.

[0094] Application of formula (1) in counterfactual GAN:

[0095] In the counterfactual GAN, the generator generates virtual samples based on hypothetical scenario conditions to simulate the operation of the power system under different risk conditions. The discriminator uses the two terms in the formula to identify the difference between the real historical data and the hypothetical scenario data to ensure that the generated virtual samples meet the set risk scenarios.

[0096] The present invention is not limited to the above-mentioned embodiments. Anyone should be aware that any structural changes made under the enlightenment of the present invention, and any technical solutions that are the same or similar to the present invention, fall within the protection scope of the present invention. The technology, shape, and structural parts not described in detail in the present invention are all well-known technologies.

Claims

1. A method for compressing a small amount of data fine-tuning and self-repairing generation model for specific tasks in power systems, characterized in that: The following steps are involved: S1: Use historical data of the power system to train a basic large model and extract key features. Then transfer the knowledge of the large model to the small model and use structured pruning and quantization techniques to reduce model parameters. S2: After completing the model compression, fine-tune the small model using a small amount of task-specific data to optimize its adaptability and prediction ability in different scenarios; S3: Monitor environmental variables in power operation during power system operation. If it detects that external conditions deviate from the normal state, automatically collect data fragments related to the current changing situation and use them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model. S4: The real-time monitoring module detects deviations in device data. When it detects that sensor data or device status exceeds a set threshold, it records abnormal samples and triggers the self-healing GAN. The self-healing GAN takes abnormal data and normal operation history as input to generate replacement samples to supplement or replace abnormal data. S5: Based on risk assessment requirements and historical operating data, several hypothetical scenarios are created. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data to simulate the operating effects of the power system under different strategies, evaluate the effects of the operating strategies, and adjust the control strategies based on the simulation results. S6: The data generated by context-aware, self-healing, and counterfactual GANs are synchronously fed back to the model with real-time data for dynamic optimization. When long-term trend changes are detected, new fine-tuning and sample generation processes are automatically initiated.

2. According to claim 1, a method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system, characterized in that: S1 uses the historical data of the power system to train the basic large model and extract key features. Then, the knowledge of the large model is transferred to the small model through knowledge distillation, and the steps of reducing model parameters by using structured pruning and quantization techniques are as follows: S101: Use the historical load data and equipment status data of the power system to train the basic large model, extract the data time series characteristics, nonlinear relationships and power equipment operation rules, and its expression is: Among them, L seq is the loss of time series prediction, N is the number of samples, y t is the actual load or state value, x t is the input data, f(x t , θ) is the predicted output of the model, and θ is the parameter of the model; S102: After the large model completes training based on the historical data of the power system, it generates soft labels for the input samples. Subsequently, the small model receives the same input samples, calculates its own output probability, and compares it with the soft labels of the teacher model. Finally, during the training process, the small model continuously optimizes its own weights and gradually learns the reasoning logic of the teacher model. S103: After the knowledge transfer is completed, the structured pruning technology is used on the small model to remove neurons, channels or layers with low computational contribution. Then, the pruning algorithm identifies redundant filters and deletes them. Then, based on the pruned model, the formula Convert the model’s floating-point weights and activation values ​​to low-bit representations, where W quantized is the quantized weight, W pruned is the pruned weight matrix, Δ is the quantization step size, and round() is rounded to the nearest integer.

3. A method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 2, characterized in that: In order to narrow the output gap between the small model and the teacher model during the training process, S102 also designed a distillation loss function, which combines the soft label loss with the cross entropy loss of the true label. At the same time, a temperature parameter is introduced in the distillation process to adjust the probability distribution of the teacher model output. When the temperature is high, the probability distribution of the teacher model output is smoother.

4. According to claim 1, a method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system, characterized in that: After completing the model compression, the steps to fine-tune the small model using a small amount of data for a specific task to optimize its adaptability and predictive ability in different scenarios are: A small amount of relevant data is extracted from the specific tasks of the power system and filtered and labeled according to the target task to ensure that the data covers the main features of the target scenario. Then, the compressed basic small model is used as the initial state of the fine-tuning model, and the weights and parameters learned in the previous model training are loaded. Subsequently, the small model is trained using the fine-tuning dataset, and the prediction ability of the model in a specific scenario is evaluated through the validation set. The model performance is dynamically monitored during the training process. If an overfitting trend is detected, the training is stopped in advance to optimize the results.

5. The method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 1, characterized in that: S3 monitors environmental variables in power operation during power system operation. If it detects that external conditions deviate from the normal state, it automatically collects data fragments related to the current changing situation and uses them to initialize the context-aware GAN. Then, the context-aware GAN generates samples based on these data to calibrate and update the fine-tuned model in the following steps: S301: Real-time monitoring of environmental variables in the power system. If it is detected that the external conditions exceed the set threshold, the data fragments related to the change situation are automatically collected, and the time, location and equipment status of the change are recorded. Then, the relevant data fragments are used as input to initialize the generator and discriminator of the context-aware GAN; S302: The context-aware GAN generator generates preliminary samples according to the characteristics of the input data, and the context-aware GAN discriminator screens the generated samples to ensure that the output samples meet the current context characteristics; S303: The context-aware GAN generates sample data that conforms to the current context through repeated training. These samples capture the operating characteristics of the power system in a specific environment. The generated samples are used to calibrate the fine-tuned model, and its expression is: Among them, L calibrate is the mean square error loss of model calibration, y i is the target value of the actual operating data, To fine-tune the model's predicted output for the generated samples, m is the number of generated samples.

6. A method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 1, characterized in that: The S4 real-time monitoring module detects deviations in device data. When it detects that sensor data or device status exceeds the set threshold, it records abnormal samples and triggers the self-healing GAN. The self-healing GAN takes abnormal data and normal operation history as input and generates replacement samples to supplement or replace abnormal data in the following steps: S401: Through the sensor and equipment monitoring module, the operation data in the power system is continuously detected. When the monitored data exceeds the set normal threshold or deviates from the normal trend, the abnormal sample and its related time, location and equipment information are recorded. Then, the detected abnormal data is marked and compared with the normal operation data to confirm the source and nature of the deviation. Once the abnormality is confirmed, the self-healing GAN is immediately triggered. Among them, the self-healing GAN model takes the abnormal data and the normal operation history as input to prepare for the generation of replacement samples. Its expression is: Among them, E dev is the degree of deviation of abnormal data, is the i-th observation data (abnormal sample), is the i-th corresponding normal data point, and n is the number of samples; S402: When replacing samples, the generator of the repair GAN model generates preliminary replacement samples according to the historical operating rules, and the discriminator of the repair GAN model simultaneously evaluates whether the generated samples match the normal data. When the generator and the discriminator are consistent, the replacement samples output by GAN are used to replace abnormal data or fill data gaps. Finally, the replacement samples are fed back to the real-time monitoring module of the power system and used to calibrate the fine-tuned prediction model.

7. A method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 1, characterized in that: S5 creates several hypothetical scenarios based on risk assessment requirements and historical operating data. The counterfactual GAN ​​uses these hypothetical conditions and historical data as input to generate virtual sample data to simulate the operating effects of the power system under different strategies, evaluate the effects of the operating strategies, and adjust the control strategy according to the simulation results. The steps are as follows: S501: Based on the risk assessment requirements and historical operation data of the power system, potential risk factors are identified and several specific hypothetical scenarios are generated. After the hypothetical scenarios are created, these hypothetical conditions and historical operation data are used as input to initialize the counterfactual GAN ​​model; S502: The generator of the counterfactual GAN ​​model generates virtual sample data matching the hypothetical scenario based on these inputs, and the discriminator of the counterfactual GAN ​​model screens these samples to ensure that they meet the hypothetical conditions; S503: According to the output counterfactual GAN ​​of the generator and the discriminator, a virtual sample that conforms to the hypothetical scenario is generated, and the operation effect of the power system is simulated under different strategies. The simulation results of different strategies are compared to identify the advantages and disadvantages of each strategy in a specific scenario, and its effect is quantified according to the evaluation index. The current control strategy is optimized according to the simulation and evaluation results, and the optimized strategy is applied to the actual power system. The expression is: Among them, L sim is the mean square error between the simulation results and the actual results, is the output of the virtual sample under the jth strategy, is the output of the actual system under the same conditions, and m is the number of strategies.

8. The method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 1, characterized in that: The data generated by context-aware, self-healing, and counterfactual GANs are fed back to the model synchronously with real-time data for dynamic optimization. When long-term trend changes are detected, the steps to automatically start a new fine-tuning and sample generation process are as follows: The sample data generated by the context-aware GAN, self-healing GAN, and counterfactual GAN ​​are synchronously fed back to the fine-tuned power system model with the real-time operation data. Then, the real-time monitoring data X t With historical reference data X h Integration, calculate the error at the current time t, its expression is Among them, E t represents the mean square error X at time t t,i is the i-th real-time sample, X h,i is the corresponding historical data sample, n is the number of samples; Adopt an adaptive learning rate strategy to dynamically adjust the model weight according to the error and set the current weight to W t , then the update rule is: Among them, W t+1 is the updated weight, η is the dynamic learning rate, and then, by monitoring the error trend, the learning rate update formula based on the error change rate is adopted: Based on long-term trend analysis, automatically adjust the model's rules or strategies, where η t is the current learning rate, and α is the adjustment coefficient.

9. The method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 1, characterized in that: Collect historical data, real-time environmental data, and abnormal data in the power system, and build corresponding training data sets based on situational awareness, self-repair, and hypothetical scenarios; Initialize the generator parameters of context-aware, self-healing, and counterfactual GANs. The generator contains multiple convolutional layers, activation functions, and dropout layers. The generator generates initial samples based on input noise and context features, and adjusts the generator weights to make the generated samples gradually approach the real data distribution. Initialize the discriminator parameters of context-aware, self-repairing, and counterfactual GANs. The discriminator contains multiple convolutional layers, activation functions, and dropout layers. The discriminator receives real data and data generated by the generator, compares them, and through adversarial training, enables the discriminator to accurately distinguish between generated samples and real samples; Combining the loss function L of the generator and the discriminator GAN (G, D), continuously optimizing the parameters of the generator and the discriminator.

10. A method for compressing a small amount of data fine-tuning and self-repairing generation model for a specific task in a power system according to claim 9, characterized in that: The generator and discriminator of the context-aware GAN are initialized based on the real-time environmental data of the power system. The generator takes the current context data as input to generate samples that match the actual environment, and the discriminator verifies the authenticity of the generated samples through the adversarial loss function of formula (1). After detecting abnormal data in the power system, the generator of the self-repairing GAN generates replacement samples based on the normal operating data, and the discriminator determines whether the replacement samples are consistent with the normal data distribution according to formula (1); According to the risk assessment requirements of the power system, a counterfactual GAN ​​is used to create a hypothetical scenario. The generator accepts the conditional input of the hypothetical scenario and generates virtual samples that match the scenario. The discriminator uses formula (1) to screen samples that meet the hypothetical conditions. Among them, L GAN (G, D) is the adversarial loss function, which is the loss between the generator G and the discriminator D. G is the generator model, D is the discriminator model, x is a real data sample, which comes from the actual observation data or historical data in the power system, representing the normal or expected state, and p data (x) is the real data distribution, z is the random input noise of the generator, p z (z) is the noise distribution, and D(x) is the score or probability of the discriminator for the input x.

Citation Information

Cited By

  • Large-model cross-end transfer compression method and device applied to intelligent electric energy meter

    CN120321130A

  • Fault diagnosis and suggestion method based on interpretable artificial intelligence and large model

    CN120338140A

  • Retrieval model training method, reply obtaining method and device

    CN120849541A

  • Training method of retrieval model, answer obtaining method and device

    CN120849541B