Power transmission line relay protection setting value prediction method, system and platform based on large language model
Through the transmission line relay protection fixed value prediction method based on the large language model, the pre-trained and fine-tuned model is used to represent the tensor of transmission line parameters and control words, the complexity and cumbersomeness of the calculation of the transmission line relay protection fixed value is solved, and high-precision fixed value prediction and automated adjustment are realized, which improves the safety and reliability of the power system.
Patent Information
- Application Number
- CN202510277233.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-03-10
AI Technical Summary
The prior art has problems of computational complexity and cumbersomeness in the calculation of constant value of relay protection of transmission lines, making it difficult to achieve high-precision fixed value adjustment, resulting in untimely failure removal or malfunctioning, affecting the safe operation of the power system.
The transmission line relay protection constant value prediction method based on the large language model is adopted. The transmission line relay protection constant value prediction method is predicted by pre-trained and fine-tuned transmission line relay protection constant value, combined with the transmission line parameters and tensor representation of the relay protection control word, data processing and analysis are carried out to generate accurate relay protection constant value prediction results, and tuning suggestions are given.
It improves the accuracy and efficiency of constant value prediction of transmission line relay protection, reduces manual intervention and operation errors, improves the automation and intelligence level of relay protection systems, and supports intelligent setting of fixed value.
Smart Images

Figure BDA0005304594610000041 
Figure BDA0005304594610000101 
Figure BDA0005304594610000102
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of relay protection, and more specifically, to a method, system and platform for predicting transmission line relay protection constants based on a large language model. Background Art
[0002] As power systems evolve and change, the parameters and operating modes of transmission lines will also change. The correct operation of transmission line relay protection depends on accurate action settings. Reasonable relay protection setting ensures that protection devices can adapt to these changes and meet the operational requirements of the power system. As a key parameter, the protection setting directly determines the speed and accuracy of relay protection response when a fault occurs. Setting the setting too high may prevent the fault from being cleared in a timely manner, increasing the risk of accidents. Setting the setting too low may cause false operation, affecting the normal operation of the power system. Therefore, how to scientifically and accurately calculate and set transmission line relay protection settings is a crucial research topic for ensuring power system security.
[0003] Traditional relay protection setting calculations rely primarily on specialized software for setting calculations, and annual verification is completed through manual comparison of setting values, which consumes a lot of manpower. Currently, relay protection setting calculations are moving towards automation and integration, integrating various protection and monitoring functions to improve system efficiency, reliability, and safety. For example, some advanced relay protection setting calculation platforms have implemented process-guided automatic setting and verification, connecting all the setting steps, including parameter modeling, principle coordination, setting templates, and setting order issuance. This has significantly improved the efficiency and accuracy of setting calculations. However, the level of intelligence still needs to be improved when dealing with the complex and changing operating environment of power systems.
[0004] The rapid development of artificial intelligence models in numerical prediction and their ability to understand and process language offer significant advantages in power system fault diagnosis and system optimization. Existing methods for relay protection setting calculation and verification aim to facilitate setting comparison and verification during protection operation and maintenance, but fail to address the complexity and tediousness of relay protection setting calculation. The advancement of artificial intelligence technology, particularly machine learning and deep learning, has provided opportunities for optimizing this process. The challenge and key point of using artificial intelligence models to assist in relay protection setting calculation lies in preparing data and training models to adapt to relay protection setting calculation tasks, given the numerous parameters and complex operating conditions of transmission lines, thereby improving the accuracy and effectiveness of relay protection setting setting. As power systems continue to demand ever-increasing accuracy in relay protection setting calculation, traditional data processing and model training methods struggle to meet these requirements, limiting the accuracy and effectiveness of transmission line setting prediction and setting results. Summary of the Invention
[0005] In order to solve the problem of low prediction of relay protection constants in the current method of relay protection constant prediction based on artificial intelligence technology, the present invention proposes a transmission line relay protection constant prediction method, system and platform based on a large language model. Based on an improved input data processing method, a pre-trained and fine-tuned large language model is used to better apply to the relay protection constant prediction of complex and diverse transmission lines, and it can answer staff's questions about constant setting, thereby improving the accuracy and effect of relay protection constant prediction, reducing manual intervention, reducing operational errors and labor costs, and improving the automation and intelligence level of relay protection.
[0006] In order to solve the above technical problems, the technical solutions of the present invention are as follows:
[0007] In a first aspect, the present application proposes a method for predicting transmission line relay protection settings based on a large language model, comprising the following steps:
[0008] Get input text;
[0009] Determine whether the input text contains a transmission line relay protection setting prediction prompt term. If so, encode the transmission line parameter following the prompt term using a numerical interval deviation and convert it into input value tokens. Otherwise, perform word segmentation on the input text and convert it into input text tokens.
[0010] Inputting the input numerical tokens or text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or text tokens;
[0011] Based on the output numerical tokens, the transmission line relay protection setting prediction setting list is generated, and based on the output text tokens, the transmission line relay protection prediction response dialogue content is generated.
[0012] Preferably, the input text includes question dialogue text, transmission line parameters and relay protection control words; the transmission line parameters and relay protection control words are respectively converted into tensor forms to obtain a transmission line parameter tensor and a relay protection control word tensor, the elements in the transmission line parameter tensor correspond to different transmission line parameter types, and the elements in the relay protection control word tensor correspond to different relay protection control word types; the transmission line relay protection constant value prediction prompt entry is followed by the transmission line parameter tensor.
[0013] By adopting the above technical solution, the transmission line parameters and relay protection control words are converted into tensor form, which can unify the data representation method and conveniently represent various complex data structures, so that different types of data can be processed and analyzed in the subsequent pre-trained transmission line relay protection constant prediction large language model, thereby improving processing efficiency.
[0014] Preferably, the process of converting the power transmission line parameter following the prompt entry into input value Tokens through numerical interval deviation encoding includes:
[0015] According to the distribution range of the transmission line parameter values, discrete intervals are defined and numbered, and each transmission line parameter value is mapped into the discrete interval to obtain the interval deviation value;
[0016] Convert the transmission line parameter values into a tensor composed of Tokens to obtain input value Tokens;
[0017] The interval number and interval deviation value are combined into the ID of the input value Tokens to realize the encoding of the transmission line parameter value to the input value Tokens.
[0018] By adopting the above technical solution, the transmission line parameters are discretized, the data representation is simplified, and the subsequent large language model is convenient for data processing and analysis, which improves the calculation efficiency, model performance and compatibility, and improves the accuracy and effect of the transmission line relay protection setting prediction.
[0019] Preferably, the input text is segmented in units of characters, and the input text is converted into a tensor consisting of character tokens to form input text tokens.
[0020] Preferably, the process of fine-tuning the pre-trained large language model for transmission line relay protection setting prediction includes:
[0021] Acquire transmission line relay protection setting value data, transmission line parameters and relay protection control word and pre-process them to obtain transmission line relay protection setting value data tensor, transmission line parameter tensor and relay protection control word tensor;
[0022] The transmission line parameter tensor and relay protection control word tensor are used as input samples, and the transmission line relay protection setting value single data tensor is used as input target sample. One input sample and one target sample constitute a training sample.
[0023] The training samples are divided into several mutually exclusive subsets, and the mutually exclusive subsets are used as training sets to train the pre-trained transmission line relay protection setting prediction large language model. The model is then verified based on the cross-validation method to obtain the trained pre-trained transmission line relay protection setting prediction large language model, thereby realizing fine-tuning of the pre-trained transmission line relay protection setting prediction large language model.
[0024] By adopting the above technical solution, on the basis of the pre-trained large language model for transmission line relay protection constant prediction, the pre-trained large language model is further trained for the specific task of transmission line relay protection constant prediction by combining the transmission line relay protection constant single data tensor, the transmission line parameter tensor and the relay protection control word tensor, so that it has not only a wide range of language generation capabilities but also a more accurate relay protection constant prediction calculation capability.
[0025] Preferably, in the process of training the pre-trained transmission line relay protection setting prediction large language model, the mean square error function MSE(X) of the training set and the cross-validation mean square error function MSE(Y) are obtained during the training process, and the mean square error function MSE(X) and the mean square error function MSE(Y) are combined into a new loss function Loss, which is expressed as follows:
[0026] Loss = σMSE(X) + (1-σ)MSE(Y)
[0027] Among them, σ represents the weight to be optimized, and the value of σ is between 0 and 1;
[0028] The model optimizer is used to train the pre-trained transmission line relay protection constant value prediction large language model. After several training rounds, when the loss function is minimized or the mean square error function MSE(X) of the training set is minimized, the trained pre-trained transmission line relay protection constant value prediction large language model is obtained, and the model parameters of the pre-trained transmission line relay protection constant value prediction large language model are saved.
[0029] Preferably, the process of generating the relay protection prediction setting list of the transmission line based on the output value Tokens is as follows: converting the output value Tokens into a numerical tensor, and multiplying it element-wise with the relay protection control word tensor, and the expression is:
[0030]
[0031] Among them, i represents the numerical tensor order, x i Represents the i-th constant in the numerical tensor, y i Represents x i The corresponding transmission line relay protection prediction value, the combination of all transmission line relay protection prediction values, to obtain the transmission line relay protection prediction value list; x max Represents xi Corresponding to the maximum value of the protection setting or the recommended maximum value; C i Represents the relay protection control word tensor, which is a binary tensor;
[0032] The process of generating the relay protection prediction response dialogue content of the transmission line based on the output text tokens is as follows: converting the output text tokens into text format; and post-processing the text, including removing redundant information and adjusting the text structure.
[0033] By adopting the above technical solution, the method proposed in this application has a wide range of language generation capabilities and also has more accurate relay protection constant value prediction and calculation capabilities, provides relay protection constant value setting suggestions, answers questions from questioners, and improves the accuracy and effect of transmission line relay protection constant value prediction.
[0034] In a second aspect, the present application proposes a transmission line relay protection setting value prediction system based on a large language model, wherein the system is used to implement the transmission line relay protection setting value prediction method based on a large language model, including:
[0035] A text acquisition unit, used to acquire input text;
[0036] The prompt term recognition processing unit is used to determine whether the input text contains a transmission line relay protection setting value prediction prompt term. If so, the transmission line parameter following the prompt term is encoded with a numerical interval deviation and converted into input value tokens; otherwise, the input text is segmented and converted into input text tokens.
[0037] The large language model prediction unit inputs input numerical tokens or input text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or output text tokens;
[0038] The prediction result generating unit generates a transmission line relay protection setting prediction setting list based on the output numerical value Tokens, and generates the transmission line relay protection prediction response dialogue content based on the output text Tokens.
[0039] By adopting the above system, the automation and intelligence level of relay protection can be improved, and the further development of secondary operation and maintenance of relay protection can be promoted.
[0040] Preferably, the prompt term identification processing unit includes: a prompt term identification module, an interval deviation encoding module and a word segmentation module;
[0041] The prompt term recognition module is used to determine whether the input text contains a transmission line relay protection constant value prediction prompt term; when the input text contains a transmission line relay protection constant value prediction prompt term, the interval deviation encoding module encodes the transmission line parameters after the prompt term through numerical interval deviation and converts them into input numerical tokens; when the input text does not contain a transmission line relay protection constant value prediction prompt term, the word segmentation module performs word segmentation on the input text and converts the input text into input text tokens.
[0042] On the third aspect, the present application proposes a platform equipped with the transmission line relay protection constant value prediction system based on the large language model.
[0043] Compared with the prior art, the beneficial effects of the technical solution of the present invention are:
[0044] The present invention proposes a transmission line relay protection constant value prediction method, system and platform based on a large language model. In the method, by judging whether the input text contains a transmission line relay protection constant value prediction prompt term, the input text task that does not contain the transmission line relay protection constant value prediction prompt term and the input text task that contains the transmission line relay protection constant value prediction prompt term are separated and processed. If the prompt term is not contained, the input text is segmented. If the prompt term is contained, the transmission line parameter value is interval-deviation encoded. Then, the pre-trained transmission line relay protection constant value prediction large language model is fine-tuned to improve the efficiency of subsequent data analysis, so that it has not only a wide range of language generation capabilities but also an accurate relay protection constant value prediction calculation capability, thereby improving the transmission line relay protection constant value prediction accuracy, reducing the untimely fault removal or malfunction caused by improper constant value setting, and providing relay protection constant value setting suggestions to answer questions from questioners.
[0045] The system and platform proposed in this invention can automatically predict the relay protection settings of transmission lines, reduce reliance on manual calculations and proofreading, and thus reduce labor costs and operational errors. They can process and analyze large amounts of power system data, extract useful information from it, and support intelligent setting of settings, thereby significantly improving the automation and intelligence level of the relay protection system and promoting the further development of secondary operation and maintenance of relay protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram showing a flow chart of a transmission line relay protection setting value prediction method based on a large language model proposed in an embodiment of the present invention;
[0047] Figure 2 A basic structural diagram showing a large language model for pre-training transmission line relay protection setting prediction used in an embodiment of the present invention;
[0048] Figure 3 A schematic diagram showing how the root mean square error of a training set changes with the number of training times during fine-tuning of a large language model proposed in an embodiment of the present invention;
[0049] Figure 4 A schematic diagram showing how the root mean square error of the large language model proposed in an embodiment of the present invention changes with the number of training times during fine-tuning with and without cross-validation;
[0050] Figure 5 The figure shows the composition structure of the transmission line relay protection setting prediction system based on the large language model proposed in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The accompanying drawings are for illustrative purposes only and are not to be construed as limiting this patent;
[0052] In order to better illustrate this embodiment, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product size;
[0053] It is understandable to those skilled in the art that some well-known structures and descriptions thereof may be omitted in the drawings.
[0054] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.
[0055] Example 1 This example proposes a method for predicting the relay protection setting value of a transmission line based on a large language model. The implementation flow diagram of this method is shown in FIG. Figure 1 ,like Figure 1 As shown, the method includes the following steps:
[0056] S1: Get input text;
[0057] S2: Determine whether the input text contains a transmission line relay protection setting prediction prompt term. If so, encode the transmission line parameter following the prompt term using a numerical interval deviation and convert it into input value tokens. Otherwise, perform word segmentation on the input text and convert it into input text tokens.
[0058] S3: Inputting the input numerical tokens or text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or text tokens;
[0059] S4: Generate a transmission line relay protection setting prediction setting list based on the output numerical value Tokens, and generate the transmission line relay protection prediction response dialogue content based on the output text Tokens.
[0060] In this embodiment, transmission line relay protection setting prediction prompt terms refer to keywords or phrases that directly or indirectly indicate or suggest the topic of "transmission line relay protection setting prediction." These prompt terms may include "transmission line," "relay protection," "setting," "prediction," etc., but may also include more specific terms or combinations. In natural language processing, "tokens" are the basic units of text analysis, representing a character, word, phrase, or sentence. They are a format or representation more suitable for numerical processing by large language models.
[0061] In the method proposed in this embodiment, by judging whether the input text contains the transmission line relay protection constant value prediction prompt term, the input text task that does not contain the transmission line relay protection constant value prediction prompt term and the input text task that contains the transmission line relay protection constant value prediction prompt term are separated and processed. Specifically: if the prompt term is not contained, the input text is segmented; if the prompt term is contained, the transmission line parameter value is encoded with interval deviation, and the two tasks are separated. The input text Tokens are used to perform the language generation function. According to the given input text Tokens, a pre-trained and fine-tuned transmission line relay protection constant value prediction large language model is used to generate a new natural language text, which may It includes completing sentences, generating paragraphs, answering questions or performing other similar tasks, generating question-answering dialogue content, and improving the level of intelligence; input text tokens are used to perform constant value calculation functions, and the pre-trained and fine-tuned transmission line relay protection constant value prediction large language model is used to predict the constant value. The idea of task separation improves the efficiency of data analysis, so that the large language model has accurate relay protection constant value prediction calculation capabilities while having its own extensive language generation capabilities, thereby improving the accuracy of transmission line relay protection constant value prediction, reducing the untimely fault removal or malfunction caused by improper constant value setting, and giving relay protection constant value adjustment suggestions to answer questions from questioners, thereby improving the level of intelligence.
[0062] Example 2
[0063] The input text includes question dialogue text, transmission line parameters, and relay protection control words. In this embodiment, to unify data representation and conveniently represent various complex data structures, making it easier to process and analyze different types of data in the subsequent pre-trained transmission line relay protection setting prediction large language model, the transmission line parameters and relay protection control words are converted into tensor form, respectively, to obtain a transmission line parameter tensor and a relay protection control word tensor.
[0064] The elements in the transmission line parameter tensor correspond to different transmission line parameter types, and the elements in the relay protection control word tensor correspond to different relay protection control word types. The "Transmission Line Relay Protection Setting Prediction Prompt" entry is followed by the transmission line parameter tensor.
[0065] Transmission line parameter types include resistance-type transmission lines and reactance-type transmission lines. Relay protection control words are binary codes used to control the various protection functions and operating modes of relay protection devices. By modifying the control words, relay protection device functions can be enabled, disabled, or adjusted to meet different power system protection requirements. Relay protection control word types include relay protection control words, monitoring control words, and regulation control words.
[0066] In this embodiment, the process of converting the power transmission line parameter following the prompt entry into input value tokens through numerical interval deviation encoding includes:
[0067] According to the distribution range of the transmission line parameter values, discrete intervals are defined and numbered, and each transmission line parameter value is mapped into the discrete interval to obtain the interval deviation value;
[0068] Convert the transmission line parameter values into a tensor composed of Tokens to obtain input value Tokens;
[0069] The interval number and interval deviation value are combined into the ID of the input value Tokens to realize the encoding of the transmission line parameter value to the input value Tokens.
[0070] Assuming that there is a set of numerical data of transmission line parameters, first observe the distribution range of the data and reasonably define discrete intervals. In this embodiment, these intervals are evenly divided according to the maximum and minimum values of the data. According to the number of divided intervals and the width of each interval, the discrete intervals are obtained. Then, according to the specific values, the values are mapped to different intervals, and the interval deviation value is calculated, which can be the deviation between the value in the interval and the midpoint of the interval, or the deviation between the value in the interval and the mean of the interval. The deviation value between each value and the midpoint of the interval in which it is located is calculated to simplify the data representation, facilitate subsequent large language model processing and analysis of the data, improve computing efficiency, model performance and compatibility, and improve the accuracy and effect of transmission line relay protection constant prediction.
[0071] In this embodiment, word segmentation is performed on the input text in units of characters, and the input text is converted into a tensor consisting of character tokens to form input text tokens.
[0072] In this embodiment, the pre-trained transmission line relay protection setting prediction large language model selected is the LLaMa2-7B large language model, such as Figure 2As shown, after the word segmentation and interval deviation encoding are performed in the early stage, the LLaMa2-7B large language model is entered. The LLaMa2-7B large language model includes an embedding layer, several Transformer encoder layers, a root mean square normalization layer, a linear layer, and a softmax layer. The embedding layer, several Transformer encoder layers, a root mean square normalization layer, and a linear layer are connected in sequence. In this embodiment, there are 32 Transformer encoder layers. In addition to being connected to the softmax layer, the output end of the linear layer can also be directly output. In each Transformer encoder layer, a multi-head attention mechanism unit and a feedforward network unit are included. The specific structural connection of the multi-head attention mechanism unit and the feedforward network unit can be seen in Figure 2 .
[0073] In this embodiment, the process of fine-tuning the pre-trained large language model for transmission line relay protection setting prediction includes:
[0074] The transmission line relay protection setting data, transmission line parameters and relay protection control word are obtained and pre-processed to obtain the transmission line relay protection setting data tensor, transmission line parameter tensor and relay protection control word tensor. This step is to process the transmission line relay protection setting data, transmission line parameters and relay protection control word into a format suitable for LLaMa2-7B large language model input.
[0075] The transmission line parameter tensor and relay protection control word tensor are used as input samples, and the transmission line relay protection setting value single data tensor is used as the input target sample. One input sample and one target sample constitute a training sample. In this step, each element corresponds to a different setting value type. Several training samples constitute a training sample library.
[0076] The training samples are divided into several mutually exclusive subsets, and the mutually exclusive subsets are used as training sets to train the pre-trained transmission line relay protection constant value prediction large language model, and the cross-validation method is used to verify, so as to obtain the trained pre-trained transmission line relay protection constant value prediction large language model, and realize the fine-tuning of the pre-trained transmission line relay protection constant value prediction large language model. In this embodiment, the training samples can be divided into k mutually exclusive subsets, and the union of k-1 subsets is used as the training set each time, and the remaining subset is used as the verification set. In this way, k training and cross-validation are performed, and the mean value of k test results is finally returned. This method can make more comprehensive use of the training samples. In the process of training the pre-trained transmission line relay protection constant value prediction large language model in this embodiment, the mean square error function MSE(X) of the training set and the mean square error function MSE(Y) of the cross-validation are obtained during the training process, and the mean square error function MSE(X) and the mean square error function MSE(Y) are combined into a new loss function Loss, which is expressed as:
[0077] Loss = σMSE(X) + (1-σ)MSE(Y)
[0078] Among them, σ represents the weight to be optimized, and the value of σ is between 0 and 1;
[0079] A model optimizer is used to train a pre-trained large language model for predicting the constant value of a transmission line relay protection. After several rounds of training, when the loss function is minimized or the mean square error function MSE(X) of the training set is minimized, a trained large language model for predicting the constant value of a transmission line relay protection is obtained, and the model parameters of the pre-trained large language model for predicting the constant value of a transmission line relay protection are saved. In this embodiment, the model parameters include weight parameters, such as linear layer parameters, attention layer weights, and embedding layer weights, bias parameters such as linear layer bias and normalization layer bias, and also include special parameters such as position encoding parameters and layer normalization scale parameters.
[0080] The following example illustrates this with a specific example. In a certain regional power grid, 252 sets of relay protection setting notifications for 110kV to 220kV lines were collected and compiled. The data included line parameters, relay protection primary values, protection parameter settings, protection control words, and function soft pressure plates.
[0081] Transmission line parameters, relay protection primary values, and protection settings are extracted as data samples and preprocessed into a format suitable for input to a large language model used to pretrain transmission line relay protection setting prediction. Each data sample consists of an input sample and a target sample. For example, the input line parameters for a 220kV line protection setting sheet are shown in Table 1. The converted input format consists of the term "[Value Predict] Line Parameters:" followed by a tensor consisting of the concatenated parameter values from Table 1.
[0082] Example: Input: "You are a senior professional relay protection technician. Based on the transmission line parameters I give you, please help me calculate the relay protection setting for this line. [Value Predict] Line parameters:" followed by the line parameters, as shown in Table 1.
[0083] Table 1
[0084]
[0085] The transmission line parameter format output by the pre-trained transmission line relay protection setting prediction large language model is shown in Table 2. The target format after conversion is "Prediction successful! The predicted relay protection setting of this line is:", followed by a tensor of the parameter values in Table 2.
[0086] Table 2
[0087]
[0088]
[0089] In this example, based on the Pytorch framework, the Trainer in the Transformer library is used to fine-tune the model. The learning rate is set to 2×10 -5 The batch size for each training session was set to 8, and the number of training epochs was set to 10. AdamW (Adam with Weight Decay) was chosen as the model optimizer. Compared to Adam, it incorporates a weight decay mechanism to help mitigate overfitting and performs well for training large-scale parameter models.
[0090] Figure 3 A schematic diagram showing how the root mean square error of a training set changes with the number of training times during fine-tuning of a large language model proposed in an embodiment of the present invention; Figure 3 It can be seen that during the fine-tuning training of the large language model, the root mean square error of the training set changes with the number of training times and training epochs. The root mean square error of the training set tends to be stable in the 9th and 10th epochs. Figure 4 Schematic diagram of the change of the root mean square error of the large language model proposed in the embodiment of the present invention with Epochs when cross-validation is used and when no cross-validation is used during fine-tuning. In general, the model parameters that meet the minimum loss function or the minimum root mean square error of the training set are saved. Figure 3 It can be observed that when epoch number is 8, the cross-validation root mean square error drops to the lowest level and then increases, while the training set loss function decreases steadily.
[0091] As mentioned earlier, the goal of this experiment is to predict protection value orders that the model has not yet learned. Therefore, the model's cross-validation evaluation performance is particularly important. Cross-validation results are best achieved with Epoch 8, where the mean squared error for the entire training set has dropped to a low level and stabilized. Therefore, retaining the model parameters at Epoch 8 results in optimal performance on the test set. Model training took 34 minutes, and single-sample prediction took 0.1 seconds.
[0092] The process of generating the relay protection prediction setting list of the transmission line based on the output value Tokens is as follows: the output value Tokens are converted into a numerical tensor, and multiplied element-wise with the relay protection control word tensor. The expression is:
[0093]
[0094] Among them, i represents the numerical tensor order, x i Represents the i-th constant in the numerical tensor, yi Represents x i The corresponding transmission line relay protection prediction value, the combination of all transmission line relay protection prediction values, to obtain the transmission line relay protection prediction value list; x max Represents x i Corresponding to the maximum value of the protection setting or the recommended maximum value; C i Represents the relay protection control word tensor, which is a binary tensor;
[0095] The process of generating the relay protection prediction response dialogue content of the transmission line based on the output text tokens is as follows: converting the output text tokens into text format; post-processing the text, including removing redundant information and adjusting the text structure.
[0096] Example 3
[0097] like Figure 5 As shown, this embodiment proposes a transmission line relay protection setting value prediction system based on a large language model, and the system is used to implement the transmission line relay protection setting value prediction method based on a large language model, including:
[0098] A text acquisition unit, used to acquire input text;
[0099] The prompt term recognition processing unit is used to determine whether the input text contains a transmission line relay protection setting value prediction prompt term. If so, the transmission line parameter following the prompt term is encoded with a numerical interval deviation and converted into input value tokens; otherwise, the input text is segmented and converted into input text tokens.
[0100] The large language model prediction unit inputs input numerical tokens or input text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or output text tokens;
[0101] The prediction result generating unit generates a transmission line relay protection setting prediction setting list based on the output numerical value Tokens, and generates the transmission line relay protection prediction response dialogue content based on the output text Tokens.
[0102] By adopting the above system, the automation and intelligence level of relay protection is improved, and the further development of relay protection secondary operation and maintenance is promoted. In this embodiment, the prompt term recognition and processing unit includes: a prompt term recognition module, an interval deviation encoding module and a word segmentation module; the prompt term recognition module is used to determine whether the input text contains a transmission line relay protection constant value prediction prompt term; when the input text contains a transmission line relay protection constant value prediction prompt term, the interval deviation encoding module encodes the transmission line parameter after the prompt term through a numerical interval deviation and converts it into input numerical tokens; when the input text does not contain a transmission line relay protection constant value prediction prompt term, the word segmentation module performs word segmentation processing on the input text and converts the input text into input text tokens.
[0103] When implementing the large language model-based transmission line relay protection setting prediction method using the system proposed in this embodiment, the input text includes question dialogue text, transmission line parameters, and relay protection control words. The transmission line parameters and relay protection control words are converted into tensor form, respectively, to obtain a transmission line parameter tensor and a relay protection control word tensor. Elements in the transmission line parameter tensor correspond to different transmission line parameter types, and elements in the relay protection control word tensor correspond to different relay protection control word types. The transmission line relay protection setting prediction prompt term is followed by the transmission line parameter tensor.
[0104] When the system proposed in this embodiment is used to implement the transmission line relay protection setting value prediction method based on a large language model, the interval deviation encoding module is used to encode the transmission line parameters after the prompt entry through the numerical interval deviation and convert them into input numerical tokens. The process includes:
[0105] According to the distribution range of the transmission line parameter values, discrete intervals are defined and numbered, and each transmission line parameter value is mapped into the discrete interval to obtain the interval deviation value;
[0106] Convert the transmission line parameter values into a tensor composed of Tokens to obtain input value Tokens;
[0107] The interval number and interval deviation value are combined into the ID of the input value Tokens to realize the encoding of the transmission line parameter value to the input value Tokens.
[0108] When using the system proposed in this embodiment to implement the transmission line relay protection constant prediction method based on the large language model, the Tokennizer is used as the word segmentation module to perform word segmentation on the input text in units of words, and the input text is converted into a tensor composed of word tokens to form input text tokens.
[0109] In this embodiment, the pre-trained transmission line relay protection setting prediction large language model selected is the LLaMa2-7B large language model, such as Figure 2 As shown, after the word segmentation and interval deviation encoding are performed in the early stage, the LLaMa2-7B large language model is entered. The LLaMa2-7B large language model includes an embedding layer, several Transformer encoder layers, a root mean square normalization layer, a linear layer, and a softmax layer. The embedding layer, several Transformer encoder layers, a root mean square normalization layer, and a linear layer are connected in sequence. In this embodiment, there are 32 Transformer encoder layers. In addition to being connected to the softmax layer, the output end of the linear layer can also be directly output. In each Transformer encoder layer, a multi-head attention mechanism unit and a feedforward network unit are included. The specific structural connection of the multi-head attention mechanism unit and the feedforward network unit can be seen in Figure 2 .
[0110] The process of fine-tuning the pre-trained large language model for transmission line relay protection setting prediction includes:
[0111] The transmission line relay protection setting data, transmission line parameters and relay protection control word are obtained and pre-processed to obtain the transmission line relay protection setting data tensor, transmission line parameter tensor and relay protection control word tensor. This step is to process the transmission line relay protection setting data, transmission line parameters and relay protection control word into a format suitable for LLaMa2-7B large language model input.
[0112] The transmission line parameter tensor and relay protection control word tensor are used as input samples, and the transmission line relay protection setting value single data tensor is used as the input target sample. One input sample and one target sample constitute a training sample. In this step, each element corresponds to a different setting value type. Several training samples constitute a training sample library.
[0113] The training samples are divided into several mutually exclusive subsets, and the mutually exclusive subsets are used as training sets to train the pre-trained transmission line relay protection constant value prediction large language model, and the cross-validation method is used to verify, so as to obtain the trained pre-trained transmission line relay protection constant value prediction large language model, and realize the fine-tuning of the pre-trained transmission line relay protection constant value prediction large language model. In this embodiment, the training samples can be divided into k mutually exclusive subsets, and the union of k-1 subsets is used as the training set each time, and the remaining subset is used as the verification set. In this way, k training and cross-validation are performed, and the mean value of k test results is finally returned. This method can make more comprehensive use of the training samples. In the process of training the pre-trained transmission line relay protection constant value prediction large language model in this embodiment, the mean square error function MSE(X) of the training set and the mean square error function MSE(Y) of the cross-validation are obtained during the training process, and the mean square error function MSE(X) and the mean square error function MSE(Y) are combined into a new loss function Loss, which is expressed as:
[0114] Loss = σMSE(X) + (1-σ)MSE(Y)
[0115] Among them, σ represents the weight to be optimized, and the value of σ is between 0 and 1;
[0116] The model optimizer is used to train the large language model for pre-training the transmission line relay protection constant value prediction. After several training rounds, when the loss function is minimized or the mean square error function MSE(X) of the training set is minimized, the trained large language model for pre-training the transmission line relay protection constant value prediction is obtained, and the model parameters of the large language model for pre-training the transmission line relay protection constant value prediction are saved.
[0117] Example 4
[0118] This embodiment proposes a platform equipped with the large language model-based transmission line relay protection setting prediction system proposed in Example 3. The platform proposed in this embodiment serves as the foundation for the large language model-based transmission line relay protection setting prediction system. The system is built on the platform, which provides the necessary operating environment and infrastructure for the system to operate normally and fulfill its functions. The platform includes: a prompt term recognition processing unit that determines whether the input text contains a transmission line relay protection setting prediction prompt term. If so, the transmission line parameter following the prompt term is encoded using a numerical interval deviation and converted into input numerical tokens; otherwise, the input text is segmented and converted into input text tokens. The large language model prediction unit inputs the input numerical tokens or input text tokens into a fine-tuned, pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or output text tokens. A prediction result generation unit generates a transmission line relay protection setting prediction setting list based on the output numerical tokens and generates the transmission line relay protection prediction response dialogue based on the output text tokens.
[0119] The platform proposed in this embodiment is equipped with the above-mentioned system, which can automatically realize the prediction of transmission line relay protection constants, reduce the dependence on manual calculation and proofreading, thereby reducing labor costs and operational errors; it can process and analyze large amounts of power system data, extract useful information from it, and support intelligent setting of constants, so as to significantly improve the automation and intelligence level of the relay protection system and promote the further development of relay protection secondary operation and maintenance.
[0120] The terms used in the accompanying drawings to describe the positional relationships are for illustrative purposes only and should not be construed as limiting this patent. Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not limitations on the implementation methods of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all implementation methods here. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for predicting relay protection settings of transmission lines based on a large language model, characterized in that: The following steps are involved: Get input text; Determine whether the input text contains a transmission line relay protection setting prediction prompt term. If so, encode the transmission line parameter following the prompt term using a numerical interval deviation and convert it into input value tokens. Otherwise, perform word segmentation on the input text and convert it into input text tokens. Inputting the input numerical tokens or text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or text tokens; Based on the output numerical tokens, the transmission line relay protection setting prediction setting list is generated, and based on the output text tokens, the transmission line relay protection prediction response dialogue content is generated.
2. The transmission line relay protection setting value prediction method based on a large language model according to claim 1 is characterized in that: The input text includes question dialogue text, transmission line parameters and relay protection control words; the transmission line parameters and relay protection control words are respectively converted into tensor forms to obtain a transmission line parameter tensor and a relay protection control word tensor, wherein the elements in the transmission line parameter tensor correspond to different transmission line parameter types, and the elements in the relay protection control word tensor correspond to different relay protection control word types; The transmission line relay protection setting value prediction prompt entry is followed by a transmission line parameter tensor.
3. The transmission line relay protection setting value prediction method based on a large language model according to claim 2 is characterized in that: The process of converting the transmission line parameters following the prompt entry into input value tokens through numerical interval deviation encoding includes: According to the distribution range of the transmission line parameter values, discrete intervals are defined and numbered, and each transmission line parameter value is mapped into the discrete interval to obtain the interval deviation value; Convert the transmission line parameter values into a tensor composed of Tokens to obtain input value Tokens; The interval number and interval deviation value are combined into the ID of the input value Tokens to realize the encoding of the transmission line parameter value to the input value Tokens.
4. The method for predicting transmission line relay protection settings based on a large language model according to claim 2, characterized in that: The input text is segmented in units of words, and the input text is converted into a tensor consisting of word tokens to form input text tokens.
5. The method for predicting transmission line relay protection settings based on a large language model according to claim 2, characterized in that: The process of fine-tuning the pre-trained large language model for transmission line relay protection setting prediction includes: Acquire transmission line relay protection setting value data, transmission line parameters and relay protection control word and pre-process them to obtain transmission line relay protection setting value data tensor, transmission line parameter tensor and relay protection control word tensor; The transmission line parameter tensor and relay protection control word tensor are used as input samples, and the transmission line relay protection setting value single data tensor is used as input target sample. One input sample and one target sample constitute a training sample. The training samples are divided into several mutually exclusive subsets, and the mutually exclusive subsets are used as training sets to train the pre-trained transmission line relay protection setting prediction large language model. The model is then verified based on the cross-validation method to obtain the trained pre-trained transmission line relay protection setting prediction large language model, thereby realizing fine-tuning of the pre-trained transmission line relay protection setting prediction large language model.
6. The method for predicting transmission line relay protection settings based on a large language model according to claim 5, characterized in that: In the process of training the pre-trained transmission line relay protection setting prediction large language model, the mean square error function MSE(X) of the training set and the cross-validation mean square error function MSE(Y) are obtained during the training process, and the mean square error function MSE(X) and the mean square error function MSE(Y) are combined into a new loss function Loss, which is expressed as follows: Loss = σMSE(X) + (1-σ)MSE(Y) Among them, σ represents the weight to be optimized, and the value of σ is between 0 and 1; The model optimizer is used to train the pre-trained transmission line relay protection constant value prediction large language model. After several training rounds, when the loss function is minimized or the mean square error function MSE(X) of the training set is minimized, the trained pre-trained transmission line relay protection constant value prediction large language model is obtained, and the model parameters of the pre-trained transmission line relay protection constant value prediction large language model are saved.
7. The method for predicting transmission line relay protection settings based on a large language model according to claim 2, characterized in that: The process of generating the relay protection prediction setting list of the transmission line based on the output value Tokens is as follows: convert the output value Tokens into a numerical tensor and multiply it by the relay protection control word tensor element by element. The expression is: Among them, i represents the numerical tensor order, x i Represents the i-th constant in the numerical tensor, y i Represents x i The corresponding transmission line relay protection prediction value, the combination of all transmission line relay protection prediction values, to obtain the transmission line relay protection prediction value list; x max Represents x i Corresponding to the maximum value of the protection setting or the recommended maximum value; C i Represents the relay protection control word tensor, which is a binary tensor; The process of generating the relay protection prediction response dialogue content of the transmission line based on the output text tokens is as follows: converting the output text tokens into text format; post-processing the text, including removing redundant information and adjusting the text structure.
8. A transmission line relay protection setting prediction system based on a large language model, characterized in that: The system is used to implement the transmission line relay protection setting value prediction method based on a large language model as described in any one of claims 1 to 7, comprising: A text acquisition unit, used to acquire input text; The prompt term recognition processing unit is used to determine whether the input text contains a transmission line relay protection setting value prediction prompt term. If so, the transmission line parameter following the prompt term is encoded with a numerical interval deviation and converted into input value tokens; otherwise, the input text is segmented and converted into input text tokens. The large language model prediction unit inputs input numerical tokens or input text tokens into the fine-tuned pre-trained large language model for transmission line relay protection setting prediction to generate output numerical tokens or output text tokens; The prediction result generating unit generates a transmission line relay protection setting prediction setting list based on the output numerical value Tokens, and generates the transmission line relay protection prediction response dialogue content based on the output text Tokens.
9. The transmission line relay protection setting value prediction system based on a large language model according to claim 8, characterized in that: The prompt entry recognition processing unit includes: a prompt entry recognition module, an interval deviation encoding module and a word segmentation module; The prompt term recognition module is used to determine whether the input text contains a transmission line relay protection constant value prediction prompt term; when the input text contains a transmission line relay protection constant value prediction prompt term, the interval deviation encoding module encodes the transmission line parameters after the prompt term through numerical interval deviation and converts them into input numerical tokens; when the input text does not contain a transmission line relay protection constant value prediction prompt term, the word segmentation module performs word segmentation on the input text and converts the input text into input text tokens.
10. A platform, characterized in that: The platform is equipped with the transmission line relay protection constant value prediction system based on the large language model as described in claim 8.
Citation Information
Patent Citations
Relay protection setting value checking method, device and equipment
CN116646891A
Photovoltaic generating capacity prediction method and system and readable storage medium
CN116954573A
GPT-based medical intelligent question-answering system and intelligent question-answering method
CN118116618A
Relay protection device debugging method and system based on model prediction
CN119068386A
Method of Pre-warning and Identifying Fault of Relay Protection of Intelligent Substation
US20240330540A1