Power auditing method, system and equipment based on fine-tuning large model
By performing fine-tuning and weight averaging on large-scale pre-trained models in the field of power auditing under multiple hyper-parameter configurations, a comprehensive model is built, and the performance is evaluated on the distribution offset data set, which solves the problem of poor performance of existing models in new situations. Optimize the problem, achieve higher accuracy and robustness, and meet the high standards of power auditing.
Patent Information
- Application Number
- CN202411161738.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-09-24
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The accuracy, flexibility, interpretability and generalization ability to new situations achieved by existing large-scale pre-trained models in the field of power auditing after training cannot fully meet the high standards, and a single model performs best on the validation set It does not mean that the best performance can be maintained on out-of-distribution data.
By training the model with different hyperparameter configurations, we get multiple fine-tuned models, then calculate the average of their weights, build a comprehensive model, and evaluate its performance on the test set and the distribution-shifted data set, and if the performance improves , then the comprehensive model will be used to improve the knowledge graph in the field of power auditing; otherwise, the model selection strategy or fine-tuning process will be adjusted.
Improved model accuracy and robustness without additional inference or memory costs, allowing it to more accurately identify and classify key issues in power audits, providing higher quality data analysis and decision support .
Smart Images

Figure CN118690834A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electric power technology, and in particular to an electric power audit method, system and equipment based on a fine-tuning large model. Background Art
[0002] As the complexity of power auditing increases, traditional auditing methods are facing challenges such as missing information, slow processing speed, and data interpretation difficulties. Therefore, there is an urgent need for an innovative method that can conduct power auditing in an efficient, accurate and comprehensive manner. Large pre-trained models usually refer to models that are pre-trained on a large amount of data. These models have a large number of parameters and can capture and learn complex patterns and features in the data. After training, these models can be fine-tuned on different tasks to adapt to specific application scenarios.
[0003] Currently, in the power sector, large pre-trained models have been explored and applied to perform audit tasks in order to improve the efficiency and accuracy of audit work. These models have the potential to play an important role in power auditing by virtue of their complex features and patterns learned on large amounts of data, such as identifying anomalies, predicting equipment failures, optimizing energy distribution, and evaluating grid performance by automatically analyzing large amounts of power data. However, despite the broad application prospects of large pre-trained models, they still face many challenges in actual deployment and operation. Traditionally, in order to improve the generalization ability, adaptability, and interpretability of large pre-trained models used in the power auditing field, multiple models with different hyperparameters are built, and a single model with the best performance on the validation set is selected. However, there are several disadvantages to selecting a single model and discarding the rest. First, integrating the outputs of multiple models can surpass the best single model, although this requires high computational cost during inference. Second, model fine-tuning for downstream tasks sometimes degrades out-of-distribution performance, and the single model that performs best on the retained validation set may not be the best model on out-of-distribution data.
[0004] In general, the current application of large-scale pre-trained models in the field of power auditing has the following pain points: (1) The accuracy, flexibility, interpretability and generalization ability of a single model after training often cannot fully meet the high standards required in the power auditing process. (2) Although a model may show the highest accuracy on a dedicated validation set, it does not mean that it can maintain the best performance when dealing with actual situations where the data distribution is different from the training data. Summary of the invention
[0005] The purpose of the present invention is to provide an electric power audit method, system and device based on a fine-tuned large model to solve the problems raised in the above background technology.
[0006] To achieve the above object, the present invention provides the following technical solutions: The power audit method based on fine-tuning large models includes: Step 1: Train the model using different hyperparameter configurations to obtain multiple fine-tuned models; Step 2: Calculate the average weights of multiple fine-tuned models and obtain a comprehensive model by averaging the weights; Step 3: Evaluate the performance of the comprehensive model on the test set and the distribution-shifted dataset, and determine whether the performance has improved. If so, use the comprehensive model to improve the knowledge graph in the field of power auditing. Otherwise, return to step 1 to adjust the model selection strategy or fine-tune the process.
[0007] Furthermore, in step 1, the model includes a mean fine-tuned neural network , performance optimized networks, and gradient optimized interpolation networks.
[0008] Furthermore, in the mean fine-tuning neural network In the example, we set the parameter , set the parameter , using the parameter The average value of ; The parameters , input data , pre-training initialization , hyperparameter configuration , hyperparameter configuration ; ,in , Indicates a The field of real numbers in dimensional space.
[0009] Furthermore, the construction method of the performance optimization network is as follows: Input potential parameters ; Set an empty set G; Setting temporary parameters From 1 to : like (Mean(G )) ≥ (mean(G)) then: ; Returns the mean (G).
[0010] Furthermore, the potential parameters according to In descending order, Represents model parameters The validation accuracy on the validation set is Represents the accuracy on the validation set.
[0011] Furthermore, the gradient optimization interpolation network is implemented through the loss function and validation set , find the mixing coefficient and temperature scaling parameters : ; when When parameterized as the output of Softmax, each are all positive and their values sum to one; Indicates input samples, Representation and The corresponding label or result, n represents the total number of samples in the validation set, j Indicates traversing the sample elements in the data set. Indicates the first j input samples, k Represents different models or parameter sets, Representation and The corresponding true label or result, Indicates the first The weights or mixing coefficients of the models, Indicates a k The field of real numbers in dimensional space.
[0012] Furthermore, the mathematical expression of the Softmax function is: ; Indicates that the sample belongs to the category The probability that a given sample will be output The raw scores of the categories .
[0013] Furthermore, in step 1, the hyperparameter configuration includes: The learning rate is used to control the magnitude of weight updates during model training; Weight decay, used to regularize the model; The number of training iterations is the number of times the model is trained on the training set; Optimizer, an algorithm for updating model weights; The loss function is used to evaluate the difference between the model prediction and the true label; Random seeds for reproducible model training; Model initialization, used to initialize the model parameters.
[0014] Furthermore, step 2 specifically includes: selecting k models, and the weight of each model is , the model weight after weight averaging .
[0015] Furthermore, in step 3, evaluating the comprehensive model performance on the test set and the distribution-shifted dataset specifically includes: Step 31: Determine the test set for evaluation and select or create a distribution-shifted dataset; Step 32: For model fusion, if it is a comprehensive model, the weight of the comprehensive model is calculated; Step 33: Use the fused comprehensive model to perform inference on the test set and the distribution-shifted data set to generate prediction results; Step 34: Select a performance evaluation indicator based on the task type, calculate the difference between the model prediction result and the true label for each sample in the test set, and calculate the performance indicator based on the difference; Step 35: Repeat the evaluation process from step 31 to step 34 on the distribution-shifted data set and record the performance indicators; Step 36: Perform statistical analysis on the evaluation results, including calculating the average accuracy and standard deviation; Step 37: Compare the performance results of the integrated model with the original fine-tuned model to determine whether the performance (of the integrated model) has improved.
[0016] Furthermore, judging whether the performance is improved specifically includes: Select a set of performance metrics to quantify the performance of the model, evaluate the performance of the comprehensive model on an independent test set, and evaluate the performance of the comprehensive model on a distribution-shifted dataset, such as a different data source, a different image style, or a different class distribution; Use statistical methods to determine whether the performance improvement is statistically significant, analyze samples that are incorrectly predicted by the comprehensive model, and use confusion matrix, ROC curve and Precision-Recall curve visualization tools to demonstrate the performance of the comprehensive model; Compare the ensemble (combined) model performance to the performance of the individual fine-tuned models and calculate the improvement in combined model performance, including calculating the difference or percentage improvement in accuracy and calculating confidence intervals for performance metrics.
[0017] Furthermore, in step 3, adjusting the model selection strategy or fine-tuning process specifically includes: Step 38: Design experiments to search for the optimal hyperparameter configuration, including learning rate, weight decay, and data augmentation strategy; Step 39: Fine-tune the pre-trained models independently using different hyperparameter configurations to obtain a set of models with different performances. Step 40: Evaluate the performance of each fine-tuned model on the validation set and the test set, and record the accuracy. Step 41: Based on the evaluation results, the model with the highest accuracy is selected as the basis for making the model; Step 42: Averaging the selected model weights to construct a preliminary model; Step 43: Evaluate the performance of the model on the test set and the distribution-shifted dataset and compare it with the performance of the original fine-tuned model; Step 44: Analyze the performance difference between the model and the original model to identify possible areas for improvement; Step 45: According to the results of the performance evaluation, adjust the hyperparameter configuration and optimize the model combination or weighted averaging method; Step 46: Re-fine-tune the model based on the adjusted hyperparameters; Step 47: Repeat steps 38 to 46 to continuously optimize the model selection strategy and fine-tuning process in an iterative manner.
[0018] To achieve the above object, the present invention also provides the following technical solutions: The power audit system based on fine-tuning large models includes: The training unit is used in step 1: training the model with different hyperparameter configurations to obtain multiple fine-tuned models; A calculation unit, used in step 2: calculating the average of the weights of multiple fine-tuning models, and obtaining a comprehensive model by weight averaging; The evaluation unit is used in step 3: evaluating the performance of the comprehensive model on the test set and the distribution-shifted data set, and determining whether the performance is improved. If so, the comprehensive model is used to improve the knowledge graph in the field of power auditing. Otherwise, return to step 1 to adjust the model selection strategy or fine-tune the process.
[0019] To achieve the above object, the present invention also provides the following technical solutions: A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0020] To achieve the above object, the present invention also provides the following technical solutions: A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any one of the methods described above.
[0021] Compared with the prior art, the present invention has the following beneficial effects: The method of the present invention improves the accuracy of the model by averaging multiple model weights fine-tuned under different hyperparameter configurations. The decisions of multiple models can be comprehensively considered without adding any additional reasoning or memory costs. In this way, not only the prediction accuracy of the model for power audit data is improved, but also the robustness of the model in the face of complex and diverse power system data is enhanced. This improvement means that in practical applications, the model can more accurately identify and classify key issues in power audits, thereby providing higher quality data analysis and decision support for the power industry.
[0022] The method of the present invention not only improves the generalization ability of the model, but also enhances the interpretability of model decisions by integrating the knowledge of multiple models, providing the output of the model to auditors, thereby improving the work efficiency and quality of power auditing. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 The present invention is a flow chart of the power audit method based on fine-tuning large model.
[0024] Figure 2 This is a block diagram of the power audit system based on the fine-tuning large model of the present invention.
[0025] Figure 3 It is a diagram of the internal structure of the computer device of the present invention. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] See also Figures 1 to 3 , the present invention provides a technical solution: In the field of power auditing, the application of large pre-trained models is crucial to improving the efficiency and accuracy of auditing work. However, due to the dynamics and complexity of the power system, building a complete and accurate large model faces many challenges. In order to improve the accuracy and robustness of the large model, the concepts of mean fine-tuning neural network model, performance optimization network model and gradient optimization interpolation network model are introduced. These models are based on fine-tuning large pre-trained neural networks to improve the efficiency and effectiveness of power auditing.
[0028] Method Overview: Mean-tuned neural network: In power auditing, this model fine-tunes a pre-trained neural network to identify and quantify patterns and anomalies in the power system. Consider a network with input data and parameters Neural Network Fine-tuning is similar to standard neural network training, but contains an important difference: the parameters are initialized using the values obtained through pre-training. Indicates a d The field of real numbers in dimensional space. It refers to the space of all possible parameter combinations. This means that the parameters of the model is a d dimensional real vector.
[0029] set up Represents initialization by using pre-training and hyperparameter configuration The hyperparameter configuration can include the choice of optimizer, data augmentation, number of training iterations, and the random seed that determines the order of the data.
[0030] For hyperparameter configuration ,set up Traditionally, the parameters that achieve the highest accuracy on a held-out validation set are chosen. , and the remaining parameters are discarded. In contrast, the model constructed by this method use The average value of ,in The model is constructed by averaging all fine-tuned models Build, so Through this approach, the U model is able to identify key entities and relationships in power audits, thereby improving the accuracy of audits. i Refers to the collection S A specific value in is 1 to k Any of the meanings.
[0031] Performance Optimized Network: In some cases, the hyperparameter configuration may produce a model with low accuracy, resulting in a decrease in the accuracy of the model built by this method. This problem can be avoided by building another performance optimized network model. This model is built by sequentially adding each model as its latent component, and the model is retained only when the performance on the retained validation set (disjoint with the training set and the test set) improves. Before executing this process, the models are sorted in descending order of validation set accuracy, so the performance of the performance optimized network model on the retained validation set will not perform worse than the best single model. The construction method is as follows: Input: Latent parameters (according to in descending order), Set an empty set G, Setting temporary parameters From 1 to : like (Mean(G )) ≥ (mean(G)) then: ; Returns the mean (G).
[0032] in Represents model parameters The validation accuracy on the validation set is represents the parameter set of the model, and represents the accuracy on the validation set. This approach ensures that the performance of the model ensemble in power auditing is not affected by the inclusion of inefficient models.
[0033] Gradient Optimized Interpolation Network: In addition, a more advanced gradient optimized interpolation network model is presented, which optimizes the model interpolation weights through gradient-based mini-batch optimization. The order constraint of the performance optimization network model is removed, and only one pass through the retained validation set is required. Specifically, for the loss function and validation set , the mixing coefficient is found by and temperature scaling parameters : ; when The results are better when it is parameterized as the output of Softmax, so that each are all positive numbers and their sum is one. The Softmax function is defined as follows: For a given sample, assuming the model outputs The raw scores of the categories , the Softmax function converts these scores into probabilities , where each Indicates that the sample belongs to the category The mathematical expression of the Softmax function is: ; Indicates i input samples, which are the data points that the model uses to make predictions. Representation and The corresponding label, or outcome, is the target value that the model attempts to predict. n Represents the total number of samples in the validation set, that is, right Sample point. Indicates a k The field of real numbers in dimensional space. j Represents an index used to traverse samples in a dataset or elements in a model collection. Indicates the first j An input sample is the input data received by the model to make a prediction or classification. k Represents another index used to iterate over the models collection or to reference a different model or parameter collection. Representation and The corresponding true label or outcome, which is the target value that the model is trying to predict during training. Indicates the first i The weight or mixing coefficient of each model. A category is also a numerical value. i Generally, it represents a temporary variable, such as i Used to determine the index.
[0034] This approach allows large models to better generalize and adapt to new data in power audits, thereby improving predictive capabilities for unknown situations.
[0035] By connecting and coordinating the three backbone networks, multiple models can be averaged without adding any additional reasoning or memory costs, thereby maximizing the accuracy of the model and improving the flexibility, interpretability, and generalization ability of the large model to new situations. The large models in the field of power auditing are not only comprehensive and accurate when initially built, but also able to continue to provide value over time, becoming an important support tool for power auditing work. The three methods are not in a parallel relationship, but a progressive relationship. The latter method is an advancement of the former method and is used to deal with situations that the former method cannot effectively solve. Therefore, the connection and coordination here refers to the use of other methods instead of using one method after finding that it cannot effectively solve the problem, or the use of multiple methods at the same time. "Weighted averaging of multiple fine-tuned models" is achieved by using these three methods in combination.
[0036] Hyperparameters include: Learning rate: controls how quickly weights are updated during model training.
[0037] Weight decay: Used for regularization to prevent the model from overfitting, usually used together with the learning rate.
[0038] Training iterations: The number of times the model is trained on the training set.
[0039] Optimizer: The algorithm used to update the model weights.
[0040] Loss function: It is used to evaluate the difference between the model prediction and the true label.
[0041] Random seed: used to ensure the reproducibility of the experiment.
[0042] Model initialization: How to initialize the model's parameters, such as using linear probes or zero-shot initialization.
[0043] The relationship between these hyperparameters and the three models mentioned in the article is that they are configuration options for training each independent model involved in the fusion. In the process of building a model, it is common to train multiple models with different hyperparameter configurations, and then combine the weights of these models according to a specific strategy.
[0044] The specific steps of weighted averaging of multiple fine-tuned models and obtaining a comprehensive model through weighted averaging are: 1. Fine-tune multiple models: Fine-tune the same pre-trained model using different hyperparameter configurations. These hyperparameters may include learning rate, weight decay, number of training iterations, data augmentation strategies, etc.
[0045] 2. Select the model collection: Select a set of models from the fine-tuned models, which will be used for subsequent weight averaging.
[0046] 3. Calculate the weighted average: For the selected model set, calculate the average of their weights. Specifically, if there are k models, the weight of each model is , then the model weight after weight averaging is .
[0047] 4. Evaluate the fusion model (i.e. comprehensive model): Evaluate the performance of the ensemble model on a test set or a distribution-shifted dataset to verify whether weight averaging improves the accuracy and robustness of the model.
[0048] 5. Analysis and adjustment: Based on the evaluation results, you may need to go back to step 1 and adjust hyperparameters or fine-tune the process to improve the performance of the model.
[0049] The specific steps to evaluate the model performance on the test set and the distribution shifted dataset are: 1. Prepare the test set: Determine the test set for evaluation, which is usually an independent dataset with a different distribution from the training data to test the generalization ability of the model.
[0050] 2. Prepare the distribution shift dataset: Select or create distribution-shifted datasets that differ from the original training dataset in some way (e.g., image style, category distribution, etc.) to evaluate the model’s performance in the face of new situations.
[0051] 3. Model Fusion: If it is an evaluation model, the weight of the fusion model is calculated according to the previous steps.
[0052] 4. Model Reasoning: Use the fused model to perform inference on the test set and distribution shift dataset to generate prediction results.
[0053] 5. Performance index selection: Select appropriate performance evaluation indicators according to the task type, such as accuracy, precision, recall, F1 score, etc. for classification tasks.
[0054] 6. Calculation performance indicators: For each example in the test set, the difference between the model's prediction and the true label is calculated and the performance metric is calculated based on this.
[0055] 7. Evaluate distribution shift performance: Repeat the above evaluation process on the distribution shifted dataset and record the performance metrics to understand how the model performs in the face of distribution changes.
[0056] 8. Statistical analysis: Perform statistical analysis on the evaluation results, which may include calculating average accuracy, standard deviation, etc., to fully understand the model performance.
[0057] 9. Results comparison: Compare the performance results of the fused model with the original fine-tuned model or other baseline models to analyze whether the fusion brings performance improvement.
[0058] The main methods for judging whether performance has been improved are: 1. Performance indicators: Choose appropriate performance indicators to quantify the performance of the model. For classification tasks, commonly used indicators include accuracy, precision, recall, F1 score, etc.
[0059] 2. Test set evaluation: Evaluate model performance on an independent test set. The test set should be distributed differently from the training data to ensure that the evaluation results reflect the generalization ability of the model.
[0060] 3. Distribution shift assessment: Evaluate the performance of the model on a distribution-shifted dataset. Distribution shift may include different data sources, different image styles, or different class distributions.
[0061] 4. Statistical significance test: Use statistical methods (e.g., t-test, McNemar's test, etc.) to determine whether the performance improvement is statistically significant to rule out the effects of chance.
[0062] 5. Error analysis: Analyze samples where the model made incorrect predictions to understand what types of samples or situations the model performs poorly.
[0063] 6. Visualization Tools: Use visualization tools such as confusion matrix, ROC curve, Precision-Recall curve, etc. to demonstrate the performance of the model.
[0064] 7. Model comparison: The ensemble model performance is compared with that of individual fine-tuned models or traditional ensemble methods.
[0065] 8. Quantification of performance improvement: Calculate the improvement in model performance, for example by calculating the difference in accuracy or a percentage improvement.
[0066] 9. Calculate the confidence interval: Compute confidence intervals for performance metrics to understand the range of uncertainty in performance improvement.
[0067] The specific steps to adjust the model selection strategy or fine-tuning process are: 1. Experimental design and hyperparameter search: Design experiments to search for the best hyperparameter configuration. This may include learning rate, weight decay, data augmentation strategy, etc.
[0068] 2. Fine-tune multiple models independently: The pre-trained models are fine-tuned independently using different hyperparameter configurations to obtain a set of models with different performance.
[0069] 3. Evaluate model performance: Evaluate the performance of each fine-tuned model on the validation set and the test set, recording the accuracy and other relevant metrics.
[0070] 4. Select the model collection: Based on the evaluation results, a set of well-performing models are selected as the basis for making the model.
[0071] 5. Build the model: The selected model weights are averaged to construct a preliminary model.
[0072] 6. Performance evaluation and comparison: The performance of the model is evaluated on the test set and the distribution-shifted dataset and compared with the performance of the original fine-tuned model.
[0073] 7. Analyze performance differences: Analyze the performance differences between your model and the original model to identify possible areas for improvement.
[0074] 8. Adjust hyper parameters: Based on the results of the performance evaluation, adjust the hyperparameter configuration and try to find a better model combination or weight averaging method.
[0075] 9. Re-fine-tune: Re-fine-tune the model based on the adjusted hyperparameters.
[0076] 10 Iteration Optimization: Repeat the above steps to continuously optimize the model selection strategy and fine-tuning process in an iterative manner.
[0077] 11. In-depth analysis: Perform in-depth analysis on the fused model, including error analysis, feature visualization, etc., to better understand the model's behavior.
[0078] 12. Final Assessment: After completing all the tuning, a final performance evaluation was performed to ensure that the model showed improved performance on various datasets.
[0079] (1) In the field of power auditing, the accuracy and robustness of models are crucial because they directly affect the reliability and efficiency of audit results. Traditional model optimization methods usually rely on a single model that performs best on the validation set. However, this approach may not fully utilize the information contained in all trained models. To overcome this limitation, an innovative method is proposed to improve the accuracy of the model by averaging the weights of multiple models fine-tuned under different hyperparameter configurations. The decisions of multiple models can be comprehensively considered without adding any additional reasoning or memory costs. In this way, not only the prediction accuracy of the model for power audit data is improved, but also the robustness of the model is enhanced when facing complex and diverse power system data. This improvement means that in practical applications, the model can more accurately identify and classify key issues in power auditing, thereby providing higher quality data analysis and decision support for the power industry.
[0080] (2) In the field of power auditing, a common problem in the model fine-tuning process is that the model performs well on a specific downstream task, but its performance deteriorates when faced with out-of-distribution data, which may lead to inaccurate audit results. By averaging multiple independently fine-tuned models, the model in this method not only performs well on specific tasks, but is also better able to adapt to new and unseen situations. This improvement in capability is particularly important for power auditing, because the power system environment is complex and changeable, requiring the model to be able to explain and adapt to a variety of different operating conditions and abnormal situations. In addition, strengthening the interpretability of the model is also an important aspect of this method. In power auditing, the decision-making process of the model needs to be transparent and traceable so that auditors can understand and trust the output of the model. Through this method, not only the generalization ability of the model is improved, but also the interpretability of the model decision is enhanced by integrating the knowledge of multiple models. This allows auditors to rely on the output of the model with more confidence, thereby improving the efficiency and quality of power auditing.
[0081] This paper proposes an innovative method to improve the accuracy of the model, especially when fine-tuning large pre-trained models for application in the field of power auditing. Instead of simply selecting a single model that performs best on the validation set, this method builds a model by integrating multiple model weights that are fine-tuned based on different hyperparameter settings. The advantage of this method is that it can significantly improve the accuracy and robustness of the model without adding any additional computational or memory overhead in the model inference phase. In this way, the unique advantages of each fine-tuned model can be fully utilized and their knowledge can be merged to obtain a comprehensive model that performs better on power auditing tasks.
[0082] This solves a traditional problem, that is, after the model is fine-tuned on a specific downstream task, its performance may degrade when facing out-of-distribution data. This approach can reduce the overfitting of the model to a specific data distribution and enhance its adaptability and generalization to new situations. This is particularly important in the field of power auditing, because auditing tasks often require models to be able to handle a variety of different data sets and make accurate predictions and judgments on potential risks and problems. By improving the interpretability and generalization ability of the model, not only can the efficiency of the audit work be improved, but also the quality and reliability of the audit results can be ensured.
[0083] like Figure 2 As shown in the figure, the power audit system based on fine-tuning large model includes: The training unit is used in step 1: training the model with different hyperparameter configurations to obtain multiple fine-tuned models; A calculation unit, used in step 2: calculating the average of the weights of multiple fine-tuning models, and obtaining a comprehensive model by weight averaging; The evaluation unit is used in step 3: evaluating the performance of the comprehensive model on the test set and the distribution-shifted data set, and determining whether the performance is improved. If so, the comprehensive model is used to improve the knowledge graph in the field of power auditing. Otherwise, return to step 1 to adjust the model selection strategy or fine-tune the process.
[0084] like Figure 3 As shown, the power audit device based on the fine-tuned large model can adopt various types of computing devices such as desktop computers, notebooks, PDAs and cloud servers. This device is composed of multiple components such as processors and memories, but is not limited to them and may include other components or different combinations. The device examples provided here are for illustrative purposes only and are not restrictive.
[0085] The processor can be various types of devices, such as CPU, DSP, ASIC, FPGA, etc., and can also include programmable logic devices, discrete gates, transistor logic devices and discrete hardware components, etc. The memory is used to store computer programs and modules, and the processor runs or executes the computer program modules stored in the memory and calls the data stored in the memory, thereby realizing various functions of fine-tuning the power audit of the large model.
[0086] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (SecureDigital, SD) card, a flash card (FlashCard), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0087] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the power audit method based on the fine-tuning large model are implemented.
[0088] If the power audit method based on fine-tuning large model is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device.
[0089] Based on such understanding, the present invention implements all or part of the processes in the above-mentioned power audit method based on fine-tuning large models, and can also be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned power audit method based on fine-tuning large models can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or preset intermediate form, etc.
[0090] Computer-readable storage media may refer to any entity or device that can carry computer program code, including recording media, USB flash drives, mobile hard drives, disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), software distribution media, etc.
[0091] It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electrical carrier signals and telecommunication signals.
[0092] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. The power audit method based on fine-tuning large model is characterized by: include: Step 1: Train the model using different hyperparameter configurations to obtain multiple fine-tuned models; Step 2: Calculate the average weights of multiple fine-tuned models and obtain a comprehensive model by averaging the weights; Step 3: Evaluate the performance of the comprehensive model on the test set and the distribution-shifted dataset, and determine whether the performance has improved. If so, use the comprehensive model to improve the knowledge graph in the field of power auditing. Otherwise, return to step 1 to adjust the model selection strategy or fine-tune the process.
2. The method according to claim 1, characterized in that In step 1, the model consists of a mean-tuned neural network , performance optimized networks, and gradient optimized interpolation networks.
3. The method according to claim 2, characterized in that Fine-tuning the neural network on the mean In the example, we set the parameter , set the parameter , using the parameter The average value of ; The parameters , input data , pre-training initialization , hyperparameter configuration , hyperparameter configuration ; ,in , Indicates a The field of real numbers in dimensional space.
4. The method according to claim 2, characterized in that The performance optimization network is constructed as follows: Input potential parameters ; Set an empty set G; Setting temporary parameters From 1 to : like (Mean(G )) ≥ (mean(G)) then: ; Returns the mean (G).
5. The method according to claim 4, characterized in that Potential parameters according to In descending order, Represents model parameters The validation accuracy on the validation set is Represents the accuracy on the validation set.
6. The method according to claim 2, characterized in that Gradient optimization interpolation network through loss function and validation set , find the mixing coefficient and temperature scaling parameters : ; when When parameterized as the output of Softmax, each are all positive and their values sum to one; Indicates input samples, Representation and The corresponding label or result, n represents the total number of samples in the validation set, j Indicates traversing the sample elements in the data set. Indicates the first j input samples, k Represents different models or parameter sets, Representation and The corresponding true label or result, Indicates the first The weights or mixing coefficients of the models, Indicates a k The field of real numbers in dimensional space.
7. The method according to claim 6, characterized in that The mathematical expression of the Softmax function is: ; Indicates that the sample belongs to the category The probability that a given sample will be output The raw scores of the categories .
8. The method according to claim 1, characterized in that In step 1, the hyperparameter configuration includes: The learning rate is used to control the magnitude of weight updates during model training; Weight decay, used to regularize the model; The number of training iterations is the number of times the model is trained on the training set; Optimizer, an algorithm for updating model weights; The loss function is used to evaluate the difference between the model prediction and the true label; Random seeds for reproducible model training; Model initialization, used to initialize the model parameters.
9. The method according to claim 1, characterized in that Step 2 specifically includes: Select k models, and the weight of each model is , the model weight after weight averaging .
10. The method according to claim 1, characterized in that In step 3, the comprehensive model performance is evaluated on the test set and the distribution-shifted dataset, specifically including: Step 31: Determine the test set for evaluation and select or create a distribution-shifted dataset; Step 32: For model fusion, if it is a comprehensive model, the weight of the comprehensive model is calculated; Step 33: Use the fused comprehensive model to perform inference on the test set and the distribution-shifted data set to generate prediction results; Step 34: Select a performance evaluation indicator based on the task type, calculate the difference between the model prediction result and the true label for each sample in the test set, and calculate the performance indicator based on the difference; Step 35: Repeat the evaluation process from step 31 to step 34 on the distribution-shifted data set and record the performance indicators; Step 36: Perform statistical analysis on the evaluation results, including calculating the average accuracy and standard deviation; Step 37: Compare the performance results of the integrated model with the original fine-tuned model to determine whether the performance has improved.
11. The method according to claim 1 or 10, characterized in that: Determining whether performance has been improved specifically includes: Select a set of performance metrics to quantify the performance of the model, evaluate the performance of the comprehensive model on an independent test set, and evaluate the performance of the comprehensive model on a distribution-shifted dataset, such as a different data source, a different image style, or a different class distribution; Use statistical methods to determine whether the performance improvement is statistically significant, analyze samples that are incorrectly predicted by the comprehensive model, and use confusion matrix, ROC curve and Precision-Recall curve visualization tools to demonstrate the performance of the comprehensive model; Compare the combined model performance to the performance of a single fine-tuned model and calculate how much the combined model's performance improved, including calculating the difference or percentage improvement in accuracy and calculating confidence intervals for performance metrics.
12. The method according to claim 1, characterized in that In step 3, adjusting the model selection strategy or fine-tuning process specifically includes: Step 38: Design experiments to search for the optimal hyperparameter configuration, including learning rate, weight decay, and data augmentation strategy; Step 39: Fine-tune the pre-trained models independently using different hyperparameter configurations to obtain a set of models with different performances. Step 40: Evaluate the performance of each fine-tuned model on the validation set and the test set, and record the accuracy. Step 41: Based on the evaluation results, select the model with the highest accuracy as the basis for making the model; Step 42: Averaging the selected model weights to construct a preliminary model; Step 43: Evaluate the performance of the model on the test set and the distribution-shifted dataset and compare it with the performance of the original fine-tuned model; Step 44: Analyze the performance difference between the model and the original model to identify possible areas for improvement; Step 45: According to the results of the performance evaluation, adjust the hyperparameter configuration and optimize the model combination or weighted averaging method; Step 46: Re-fine-tune the model based on the adjusted hyperparameters; Step 47: Repeat steps 38 to 46 to continuously optimize the model selection strategy and fine-tuning process in an iterative manner.
13. The power audit system based on fine-tuning large model is characterized by: include: The training unit is used in step 1: training the model with different hyperparameter configurations to obtain multiple fine-tuned models; A calculation unit, used in step 2: calculating the average of the weights of multiple fine-tuning models, and obtaining a comprehensive model by weight averaging; The evaluation unit is used in step 3: evaluating the performance of the comprehensive model on the test set and the distribution-shifted data set, and determining whether the performance is improved. If so, the comprehensive model is used to improve the knowledge graph in the field of power auditing. Otherwise, return to step 1 to adjust the model selection strategy or fine-tune the process.
14. The system of claim 13, wherein: In step 1, the model consists of a mean-tuned neural network , performance optimized networks, and gradient optimized interpolation networks.
15. The system of claim 14, wherein: Fine-tuning the neural network on the mean In the example, we set the parameter , set the parameter , using the parameter The average value of ; The parameters , input data , pre-training initialization , hyperparameter configuration , hyperparameter configuration ; ,in , Indicates a The field of real numbers in dimensional space.
16. The system of claim 14, wherein: The performance optimization network is constructed as follows: Input potential parameters ; Set an empty set G; Setting temporary parameters From 1 to : like (Mean(G )) ≥ (mean(G)) then: ; Returns the mean (G).
17. The system of claim 16, wherein: Potential parameters according to In descending order, Represents model parameters The validation accuracy on the validation set is Represents the accuracy on the validation set.
18. The system of claim 14, wherein: Gradient optimization interpolation network through loss function and validation set , find the mixing coefficient and temperature scaling parameters : ; when When parameterized as the output of Softmax, each are all positive and their values sum to one; Indicates input samples, Representation and The corresponding label or result, n represents the total number of samples in the validation set, j Indicates traversing the sample elements in the data set. Indicates the first j input samples, k Represents different models or parameter sets, Representation and The corresponding true label or result, Indicates the first The weights or mixing coefficients of the models, Indicates a k The field of real numbers in dimensional space.
19. The system of claim 18, wherein: The mathematical expression of the Softmax function is: ; Indicates that the sample belongs to the category The probability that a given sample will be output The raw scores of the categories .
20. The system of claim 13, wherein: In step 1, the hyperparameter configuration includes: The learning rate is used to control the magnitude of weight updates during model training; Weight decay, used to regularize the model; The number of training iterations is the number of times the model is trained on the training set; Optimizer, an algorithm for updating model weights; The loss function is used to evaluate the difference between the model prediction and the true label; Random seeds for reproducible model training; Model initialization, used to initialize the model parameters.
21. The system of claim 13, wherein: Step 2 specifically includes: Select k models, and the weight of each model is , the model weight after weight averaging .
22. The system of claim 13, wherein: In step 3, the comprehensive model performance is evaluated on the test set and the distribution-shifted dataset, specifically including: Step 31: Determine the test set for evaluation and select or create a distribution-shifted dataset; Step 32: For model fusion, if it is a comprehensive model, the weight of the comprehensive model is calculated; Step 33: Use the fused comprehensive model to perform inference on the test set and the distribution-shifted data set to generate prediction results; Step 34: Select a performance evaluation indicator based on the task type, calculate the difference between the model prediction result and the true label for each sample in the test set, and calculate the performance indicator based on the difference; Step 35: Repeat the evaluation process from step 31 to step 34 on the distribution-shifted data set and record the performance indicators; Step 36: Perform statistical analysis on the evaluation results, including calculating the average accuracy and standard deviation; Step 37: Compare the performance results of the integrated model with the original fine-tuned model to determine whether the performance has improved.
23. The system according to claim 13 or 22, characterized in that Determining whether performance has been improved specifically includes: Select a set of performance metrics to quantify the performance of the model, evaluate the performance of the comprehensive model on an independent test set, and evaluate the performance of the comprehensive model on a distribution-shifted dataset, such as a different data source, a different image style, or a different class distribution; Use statistical methods to determine whether the performance improvement is statistically significant, analyze samples that are incorrectly predicted by the comprehensive model, and use confusion matrix, ROC curve and Precision-Recall curve visualization tools to demonstrate the performance of the comprehensive model; Compare the combined model performance to the performance of a single fine-tuned model and calculate how much the combined model's performance improved, including calculating the difference or percentage improvement in accuracy and calculating confidence intervals for performance metrics.
24. The system of claim 13, wherein: In step 3, adjusting the model selection strategy or fine-tuning process specifically includes: Step 38: Design experiments to search for the optimal hyperparameter configuration, including learning rate, weight decay, and data augmentation strategy; Step 39: Fine-tune the pre-trained models independently using different hyperparameter configurations to obtain a set of models with different performances. Step 40: Evaluate the performance of each fine-tuned model on the validation set and the test set, and record the accuracy. Step 41: Based on the evaluation results, select the model with the highest accuracy as the basis for making the model; Step 42: Averaging the selected model weights to construct a preliminary model; Step 43: Evaluate the performance of the model on the test set and the distribution-shifted dataset and compare it with the performance of the original fine-tuned model; Step 44: Analyze the performance difference between the model and the original model to identify possible areas for improvement; Step 45: According to the results of the performance evaluation, adjust the hyperparameter configuration and optimize the model combination or weighted averaging method; Step 46: Re-fine-tune the model based on the adjusted hyperparameters; Step 47: Repeat steps 38 to 46 to continuously optimize the model selection strategy and fine-tuning process in an iterative manner.
25. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method according to any one of claims 1 to 12 when executing the computer program.
26. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Multi-dimensional audit monitoring comprehensive evaluation method
CN112508465A
Lightweight audit event identification method, system and equipment for electric power engineering field
CN117520802A
Data mining model construction method and system based on machine learning
CN118332034A
Construction method of professional question and answer model based on large language model fine tuning algorithm
CN118469020A
Cited By
Method and device for performing asynchronous parallel fine adjustment on large model based on computing power of intelligent computing center
CN120104277A
