Source load small sample time sequence prediction method, system and device based on pre-trained large language model, and storage medium
Through the time series prediction method based on the pre-trained large language model, using word segmentation coding and LoRA fine-tuning, the problem of insufficient source and load prediction accuracy of traditional methods under extreme meteorological conditions and small samples is solved, and efficient and accurate source and load prediction is achieved.
Patent Information
- Application Number
- CN202410960500.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-10-25
AI Technical Summary
Traditional source-charge prediction methods are not accurate enough in the face of extreme meteorological conditions and small samples, and simple machine learning models have limited generalization ability to represent small samples, making it difficult to meet actual needs.
A time series prediction method based on a pre-trained large language model is adopted. Through word segmentation encoding, reversible instance normalization processing and LoRA fine-tuning, the source-load prediction task is fine-tuned, making full use of the generalization ability and world knowledge of the pre-trained model.
It achieves efficient and accurate source-charge prediction under small sample conditions, avoids the need to train models separately for each scenario, and improves the accuracy and efficiency of prediction results.
Smart Images

Figure CN118839730A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to deep learning technology, and in particular to a method, system, device and storage medium for predicting source-load small sample time series based on a pre-trained large language model. Background Art
[0002] Under the current macro background of building a new power system, the uncertainty faced by system nodes has increased dramatically after a large number of renewable energy power stations have been connected to the power grid. At the same time, extreme weather phenomena have occurred frequently in various places in recent years, causing large fluctuations in renewable energy power generation in local areas. When faced with extreme meteorological conditions, traditional source-load prediction methods are often not accurate enough due to insufficient historical samples. In addition, in the distribution network scenario, due to the lack of measurement of a large number of source-load nodes and poor data quality, the small sample problem of source-load prediction has become increasingly prominent. Traditional time series prediction models often use simple machine learning model weighting strategies, which have limited generalization capabilities for the representation of small samples, resulting in prediction capabilities that are difficult to meet actual needs.
[0003] In addition, the models for time series prediction are not as versatile as those for image and NLP (natural language processing). The sampling periods of different time series prediction tasks are generally different, and the number of independent variables that affect the dependent variable is also different. Therefore, usually, it is necessary to train different models separately to deal with different forms of time series data. Summary of the invention
[0004] The technical problem to be solved by the present invention is as follows: In view of the above-mentioned problems in the prior art, a method, system, device and storage medium for predicting source-load small sample time series based on a pre-trained large language model are provided, which performs fine-tuning on the source-load prediction task on the general large language model, making full use of the powerful generalization ability and rich world knowledge of the pre-trained large language model, and meeting the needs of the source-load prediction task under the conditions of small samples.
[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0006] A method for predicting source-load small sample time series based on a pre-trained large language model comprises the following steps:
[0007] The attributes that affect the output of the source-load time series are segmented and encoded using the segmentation query vector table of the pre-trained large language model to obtain the time prompt word encoding;
[0008] Acquire source-load time series data, perform reversible instance normalization processing on the source-load time series data, and then divide the source-load time series data into different patches;
[0009] The word segmentation in the query vector table is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of Token encoding, and each patch is Token encoded using the vector query table, and then a corresponding position code is generated for each Token;
[0010] The position code and the corresponding Token code are added and then concatenated with the time cue word code, and then the concatenation result is input into the pre-trained large language model and fine-tuned, and the time cue word code part in the output vector of the pre-trained large language model is cut off and processed by the output layer to obtain the source-load time series prediction sequence;
[0011] The source-load time series prediction sequence is subjected to inverse instance normalization processing to obtain a final prediction result.
[0012] Furthermore, the attributes affecting the output of the source-load timing sequence specifically refer to the source-load timing sequence related attributes that are different in different scenarios.
[0013] Further, when the source-load time series data is divided after reversible instance normalization processing, the step of reversible instance normalization processing of the source-load time series data is included, including: using the mean and variance of each variable in the source-load time series data to normalize each variable, and the calculation formula is as follows:
[0014]
[0015] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, and ε is a constant.
[0016] Further, when the source-load time series data is divided after reversible instance normalization processing, the step of dividing the normalized source-load time series data includes:
[0017] The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels. Each channel is a sequence of a single variable. For each single variable sequence, the data at adjacent different time points are divided into the same Patch.
[0018] Furthermore, when generating the corresponding position code for each Token in the Token encoding result, it includes:
[0019] The position encoding of each Token is calculated using the non-learnable encoding in the form of sine and cosine in Transformer. The calculation formula is as follows:
[0020]
[0021] Among them, pos represents the position code of each Token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
[0022] Furthermore, the pre-trained large language model adds a LoRA fine-tuning method. When the splicing result is input into the pre-trained large language model and fine-tuned, the first stage of fine-tuning steps is included, specifically including:
[0023] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to tokenize the source load time series data in the form of a patch, and a corresponding position code is generated for each token in the token encoding result.
[0024] The position code and the corresponding token code are added together and concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model to obtain the model output through the model forward propagation process;
[0025] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0026] Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation;
[0027] Use the optimizer to update the parameters of the output layer and query vector table.
[0028] Furthermore, after the first stage fine-tuning, the second stage fine-tuning steps are also included, specifically including:
[0029] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to tokenize the source load time series data in the form of a patch, and a corresponding position code is generated for each token in the token encoding result.
[0030] The position code and the corresponding token code are added together and concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model to obtain the model output through the model forward propagation process;
[0031] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0032] Calculate the gradient of the loss value relative to the output layer, query vector table, LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model Transformer structure through backpropagation;
[0033] Use the optimizer to update the output layer, query vector table, LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model Transformer structure.
[0034] Furthermore, after the time cue word encoding part in the output vector of the pre-trained large language model is truncated and processed by the output layer to obtain the source-load time series prediction sequence, it includes:
[0035] The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain the source-load time series in the form of a patch;
[0036] Through the flattening operation of the output layer, the source-load time series sequence in the form of Patch is restored to obtain the source-load time series sequence;
[0037] The restored source-load time series is input into the linear layer of the output layer, and the Dropout operation of the output layer is performed to prevent the model from overfitting.
[0038] Obtain the data after the linear layer and Dropout processing to obtain the source load time series prediction sequence.
[0039] Furthermore, when the source-load time series prediction sequence is subjected to inverse instance normalization processing, the calculation formula is as follows:
[0040]
[0041] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
[0042] The present invention also proposes a source-load small sample timing series prediction system based on a pre-trained large language model, comprising a microprocessor and a computer-readable storage medium connected to each other, wherein the microprocessor is programmed or configured to execute any one of the source-load small sample timing series prediction methods based on a pre-trained large language model.
[0043] The present invention also proposes a source-load small sample time series prediction device based on a pre-trained large language model, comprising:
[0044] The time prompt word encoding module is used to perform word segmentation encoding on the attributes that affect the output of the source load time series using the word segmentation query vector table of the pre-trained large language model to obtain the time prompt word encoding;
[0045] A source load time series data segmentation module is used to obtain the source load time series data, perform reversible instance normalization processing on the source load time series data, and then divide it to obtain different blocks of the source load time series data, Patches;
[0046] The position encoding module is used to establish a query vector table and perform word segmentation encoding on the word segmentation query vector table using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding, use the vector query table to perform token encoding on each block Patch, and then generate a corresponding position encoding for each token;
[0047] A source-load timing prediction module is used to add the position code and the corresponding token code and then concatenate them with the time prompt word code, then input the concatenation result into the pre-trained large language model and perform fine-tuning, and cut off the time prompt word code part in the output vector of the pre-trained large language model and obtain the source-load timing prediction sequence after processing through the output layer;
[0048] The prediction result processing module is used to perform inverse instance normalization processing on the source-load time series prediction sequence to obtain a final prediction result.
[0049] Furthermore, the attributes that affect the output of the source-load time series in the time cue word encoding module specifically refer to source-load time series related attributes that are different in different scenarios.
[0050] Further, when the source load time series data segmentation module performs reversible instance normalization processing on the source load time series data and then divides it, it includes the step of performing reversible instance normalization processing on the source load time series data, including: using the mean and variance of each variable in the source load time series data to normalize each variable, and the calculation formula is as follows:
[0051]
[0052] Where k represents the number of variables, γk and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, and ε is a constant.
[0053] Furthermore, when the source load time series data segmentation module performs reversible instance normalization processing on the source load time series data and then divides it, the step of dividing the normalized source load time series data includes:
[0054] The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels. Each channel is a sequence of a single variable. For each single variable sequence, the data at adjacent different time points are divided into the same block Patch.
[0055] Furthermore, when the position encoding module generates a corresponding position encoding for each marker Token in the marker Token encoding result, it includes:
[0056] The position encoding of each token is calculated using the non-learnable encoding in the form of sine and cosine in the transformer. The calculation formula is as follows:
[0057]
[0058] Among them, pos represents the position code of each token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
[0059] Furthermore, the pre-trained large language model of the source-load timing prediction module adds a low-rank adaptive LoRA fine-tuning method. When the source-load timing prediction module inputs the splicing result into the pre-trained large language model and performs fine-tuning, the first stage fine-tuning steps are included, specifically including:
[0060] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0061] The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process;
[0062] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0063] Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation;
[0064] Use the optimizer to update the parameters of the output layer and query vector table.
[0065] Furthermore, after the first stage fine-tuning of the source-load timing prediction module, a second stage fine-tuning step is also included, specifically including:
[0066] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0067] The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process;
[0068] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0069] Calculate the gradient of the loss value relative to the output layer, the query vector table, the low-rank adaptation LoRA low-rank fine-tuning matrix, and the layer normalization parameters in the pre-trained large language model converter Transformer structure through backpropagation;
[0070] Use the optimizer to update the output layer, query vector table, low-rank adaptation LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model converter Transformer structure.
[0071] Furthermore, when the source-load time series prediction module removes the time cue word encoding part in the output vector of the pre-trained large language model and processes it through the output layer to obtain the source-load time series prediction sequence, it includes:
[0072] The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain a source-load time series in the form of patches;
[0073] Through the flattening operation of the output layer, the source-load time series in the form of patches is restored to obtain the source-load time series;
[0074] The restored source-load time series is input into the linear layer of the output layer, and the output layer is deactivated by Dropout to prevent the model from overfitting.
[0075] Obtain the data after the linear layer and the dropout method to obtain the source-load time series prediction sequence.
[0076] Furthermore, when the prediction result processing module performs inverse instance normalization processing on the source-load time series prediction sequence, the calculation formula is as follows:
[0077]
[0078] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
[0079] The present invention also proposes a computer-readable storage medium, in which a computer program is stored. The computer program is programmed or configured to execute any one of the source-load small sample time series prediction methods based on a pre-trained large language model through a processor.
[0080] Compared with the prior art, the advantages of the present invention are:
[0081] The present invention is based on a universal large language model and performs fine-tuning for the source load prediction task, making full use of the powerful generalization ability and rich world knowledge of the pre-trained large language model, so that a large number of samples are not required during training, and there is no need to train the model from scratch, thus meeting the needs of the source load prediction task under small sample conditions.
[0082] The present invention performs word segmentation encoding on the attributes that affect the output of the source-load time series sequence in the form of text description, thereby splicing the differences between different time series data into the input in the form of prompt word encoding, so that the large language model acquires a certain generalization ability for different types of source-load time series data, and there is no need to train a separate model for the source-load data of each scenario.
[0083] The present invention performs instance normalization on the source load time series data before inputting it into the model, thereby removing the unstable characteristics of the input source load data, facilitating the learning of time series information by pre-training a large language model, and facilitating gradient updates during model training; and performs inverse instance normalization on the output, reintegrating the unstable information of the original data into the output, thereby improving the accuracy of the prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0085] Figure 2 Schematic diagram of a pre-trained large language model based on the LoRA fine-tuning method in an embodiment of the present invention.
[0086] Figure 3 : is a comparison diagram between the predicted source-load curve and the actual source-load curve of an embodiment of the present invention, wherein Figure 3 (a) is a comparison chart of the predicted source load curve and the actual source load curve for long-term prediction. Figure 3 (b) is a comparison chart of the predicted source load curve and the actual source load curve for short-term prediction. Figure 3 (c) is a comparison chart of the predicted source-load curve and the actual source-load curve predicted by a small sample. DETAILED DESCRIPTION
[0087] The present invention is further described below in conjunction with the accompanying drawings and specific preferred embodiments, but the protection scope of the present invention is not limited thereby.
[0088] Embodiment 1
[0089] Compared with training a model from scratch, fine-tuning based on a pre-trained large model is obviously a more efficient solution. Therefore, this embodiment proposes a source-load small sample time series prediction method based on a pre-trained large language model, such as Figure 1 As shown, the following steps are included:
[0090] Step 1: Time cue word encoding. The attributes that affect the output of the source load time series are segmented and encoded using the word segmentation query vector table of the pre-trained large language model to obtain the time cue word encoding;
[0091] Step 2: Obtain source-load time series data, perform reversible instance normalization processing on the source-load time series data so that the sequence maintains a stable characteristic, and then divide the normalized source-load time series data, specifically by performing patching and channel separation to obtain different patch blocks of the source-load time series data;
[0092] Step 3: Create a learnable query vector table, and encode the words in the learnable query vector table using the word segmentation query vector table of the pre-trained large language model to obtain a token-encoded vector query table;
[0093] Step 4: Use the token-encoded vector lookup table to encode each patch with tokens;
[0094] Step 5: Generate the corresponding position code for each token;
[0095] Step 6: Add the position code of step 5 and the token code of step 4, and then concatenate them with the temporal cue code of step 1. Finally, input the concatenated result into the pre-trained large language model and perform fine-tuning.
[0096] Step 7: The time cue word encoding part in the output vector of the pre-trained large language model is truncated, and the source-load time series encoding part is retained. After being processed by the output layer, the source-load time series prediction sequence is obtained. The source-load time series prediction sequence is a source-load time series sequence in the form of patching.
[0097] Step 8: Separate and reorganize the source-load time series in the form of patching obtained in step 7, and then perform inverse instance normalization on the source-load time series prediction sequence to re-add the non-stationary characteristics of the time series to obtain the final prediction result.
[0098] Each step is described in detail below.
[0099] In step 1 of this embodiment, the attributes that affect the output of the source-load time series sequence specifically refer to the source-load time series related attributes that are different in different scenarios, such as the number of independent variables and the sampling period, etc. When the attributes that affect the output of the source-load time series sequence are encoded using the word segmentation query vector table of the pre-trained large language model, it specifically includes:
[0100] First, in natural language, the number of independent variables that affect the output of the source-load time series, as well as the sampling period and other related attributes of the source-load time series that are different in different scenarios, are artificially described in text. This description is targeted at a specific source-load data scenario type. For example, when using a data set of photovoltaic power generation, it can be described as "this time series data is photovoltaic power generation data, the sampling period is 15 minutes, and there are 6 variables that affect power generation, namely total solar radiation, vertical radiation, overall average radiation, temperature, air pressure, and relative humidity."
[0101] Then, the word segmentation query vector table of the original pre-trained large language model is used to perform word segmentation encoding on the form of the above text description, which is used as a prompt word to guide model prediction so that it can adapt to the requirements of different types of downstream source load data.
[0102] In step 2 of this embodiment, when reversible instance normalization is performed on the source-load time series data, the mean and variance of each variable of the input sequence are calculated respectively, and the expressions are as follows:
[0103]
[0104] Where k represents the number of variables, T x represents the length of the input sequence, T y represents the output sequence length, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data.
[0105] Then, each variable is normalized using the mean and variance of each variable in the source-load time series data. The calculation formula is as follows:
[0106]
[0107] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is a variable in the source-load time series data, and ε is a constant, which is usually set according to specific circumstances and experience to ensure that the mathematical operation in the normalization process will not fail because the denominator is zero.
[0108] In step 2 of this embodiment, when dividing the normalized source-load time series data, it includes:
[0109] The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels, each of which is a sequence of a single variable. Then, for each single variable sequence, the data at adjacent different time points are divided into the same block Patch. The division of this block Patch can be overlapping or non-overlapping in time points, and each block Patch is a marked Token. This can reduce the complexity of the model, because the computational complexity of the transformer is quadratic with the number of block tokens. Each block Patch represents a marked Token, rather than each time point representing a marked Token, which greatly reduces the number of marked Tokens. In addition, the block Patch format can also maintain the locality of the time series, because the adjacent moment values of the time series are very close, and it is more reasonable to use a block Patch as the minimum unit of calculation.
[0110] In step 3 of this embodiment, a learnable query vector table is established. The initialization word segmentation of the vector table is automatically generated by the pre-trained large language model based on the manual instructions, and is automatically updated during the fine-tuning training in the subsequent step 6. For example, the manual instruction can be "Please give me 500 word segmentations to describe the time series." After obtaining the generation result of the large language model, the 500 word segmentations are encoded according to the word segmentation query vector table of the original pre-trained model, and then used as a vector query table for token encoding, and updated in the fine-tuning training in the subsequent step 6. After training, the source load data in the form of blocks and patches processed in step 3 is tokenized according to the vector query table.
[0111] In step 4 of this implementation, the vector lookup table encoded using the tag token is a table containing fixed-size vectors, each vector corresponding to a specific tag token. Therefore, when the vector lookup table encoded using the tag token is used to encode the tag token for each block Patch, the following steps are included:
[0112] Each data point in the patch is mapped to a vector in the vector lookup table, so that for each patch, it is converted into one or more tokens. In this process:
[0113] If the data points in the patch are continuous values, they can be discretized or converted into some form of index so that the embedding vector can be queried;
[0114] If the data points in the patch are categorical variables, they can be directly converted into indices and then the corresponding embedding vectors can be queried;
[0115] Use the converted index to get the corresponding embedding vector from the vector lookup table. This process is usually implemented through matrix multiplication, where the index is the row of the matrix and the embedding vector is the column of the matrix. The obtained embedding vectors are combined into a sequence, which is the encoded token sequence.
[0116] In step 5 of this embodiment, when generating the corresponding position code for each tag token in the tag token encoding result, the position code of each tag token is calculated using the non-learnable code in the form of sine and cosine in the transformer, which can reduce the parameter burden when fine-tuning the model. The calculation formula is as follows:
[0117]
[0118] Among them, pos represents the position code of each token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
[0119] In step 6 of this embodiment, when splicing with the time prompt word code, the time prompt word code is specifically spliced to the front end of the tag Token code along the direction of the feature vector length to jointly constitute the total input, thereby achieving good generalization performance for different types of source load time series data.
[0120] In step 6 of this embodiment, the pre-trained large language model adds a low-rank adaptation LoRA fine-tuning method, such as Figure 2 As shown, the low-rank adaptation LoRA fine-tuning method is in the form of multiplying two low-rank matrices and connecting them to W through the residual q and W k Two linear projection matrices are used to update W q and W k The matrix parameters of . Its update formula can be expressed as:
[0121] W Q =W q +W1W2,
[0122] Where W1 and W2 represent two low-rank matrices, and their matrix size after multiplication is equal to W q Same; W q It is the linear projection layer in the multi-head attention of the original converter Transformer; W Q It represents the equivalent weight after update.
[0123] In step 6 of this embodiment, when the splicing result is input into the pre-trained large language model and fine-tuned, the fine-tuning step is divided into two stages. The first stage enables the source-load time series data to be aligned with the pre-trained large language model so that it can be better processed by the pre-trained large language model; the second stage further fine-tunes the specific source-load sequence type.
[0124] As mentioned above, the token-encoded learnable query vector table is generated by the pre-trained large language model according to human instructions, and is iteratively updated in the first and second stages of fine-tuning. In the first stage of fine-tuning, in addition to updating the token-encoded learnable query vector table, the parameters of the feedforward neural network in the output layer are also updated. Based on the low-rank adaptation LoRA low-rank fine-tuning method, in the second stage of fine-tuning, only W q and W k The linear matrices in the two multi-head attentions are fine-tuned, while W is not updated in the first stage of fine-tuning. q and W k In the second stage of fine-tuning, in addition to updating the parameters of the low-rank adaptive LoRA low-rank matrix, the parameters of the normalization layer are also fine-tuned, and the parameters of the feedforward neural network in the output layer and the learnable query vector table of the Token encoding are also updated synchronously.
[0125] Therefore, the steps of the first stage of fine-tuning include:
[0126] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a new vector query table for token encoding. This vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0127] The position code and the corresponding token code are added together and concatenated with the time cue code. The concatenated result is then input into the pre-trained large language model, and the model output is obtained through the model forward propagation process.
[0128] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0129] Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation;
[0130] Pass the calculated gradient to the optimizer, use the optimizer to calculate new parameters of the output layer and the query vector table, and use the new parameters to update the parameters of the output layer and the query vector table;
[0131] Repeat the above steps until the stopping condition is met, such as reaching the number of iterations or the loss value no longer decreases.
[0132] Similarly, the steps of the second stage fine-tuning after the first stage fine-tuning specifically include:
[0133] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a new vector query table for token encoding. This vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0134] The position code and the corresponding token code are added together and concatenated with the time cue code. The concatenated result is then input into the pre-trained large language model, and the model output is obtained through the model forward propagation process.
[0135] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0136] Calculate the gradient of the loss value relative to the output layer, the query vector table, the low-rank adaptation LoRA low-rank fine-tuning matrix, and the layer normalization parameters in the pre-trained large language model converter Transformer structure through backpropagation;
[0137] Pass the calculated gradient to the optimizer, and use the optimizer to update the output layer, query vector table, low-rank adaptation LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model converter Transformer structure;
[0138] Repeat the above steps until the stopping condition is met.
[0139] It can be seen from the above two specific implementation steps that in the first stage, only the output layer in step 7 and the learnable query vector table in step 3 are updated, so that the token encoding of the source-load time series can be aligned with the pre-trained large language model; in the second stage, the output layer in step 7, the learnable query vector table in step 3, the low-rank adaptation LoRA low-rank fine-tuning matrix in step 6, and the layer normalization parameters in the pre-trained large language model converter Transformer structure are updated at the same time to fine-tune the source-load time series prediction task. Both stages use the same source-load data, making full use of limited samples and adapting to the needs of small sample scenarios.
[0140] In step 7 of this embodiment, since the output size of the pre-trained large language model converter Transformer is the same as the input size, and the time prompt word encoding in step 1 is spliced at the input, the actual output should be longer than the Token encoding of the input source-load time series, but this extra part is not the required prediction result. Therefore, the prompt word part in the output vector of the pre-trained model is truncated, and the truncated length is equal to the length of the time prompt word encoding at the time of splicing, and the truncated position is also equal to the position of the time prompt word encoding at the time of splicing. After truncating the prompt word part, only the source-load time series encoding part is retained, and then the predicted source-load time series in the form of a patch is obtained through output layer processing.
[0141] In this embodiment, the output layer actually includes three operations: flattening, linear layer, and dropout. Flattening actually restores the source-load time series in the form of patches, including splitting each patch into individual time points, removing duplicate time points, and splicing the prediction results of each variable along the dimension direction to obtain the original source-load time series. Then the linear layer is used as the prediction head to output the prediction result. The final dropout method plays a role in preventing overfitting.
[0142] Therefore, in step 7, after the time cue word encoding part in the output vector of the pre-trained large language model is truncated and processed by the output layer to obtain the source-load time series prediction sequence, it includes:
[0143] The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain a source-load time series in the form of patches;
[0144] Through the flattening operation of the output layer, the source-load time series in the form of patches is restored to obtain the source-load time series;
[0145] The restored source-load time series is input into the linear layer of the output layer, and the output layer is deactivated by Dropout to prevent the model from overfitting.
[0146] Obtain the data after the linear layer and the dropout method to obtain the source-load time series prediction sequence.
[0147] In step 8 of this embodiment, the source load time series prediction sequence obtained in step 7 is subjected to inverse instance normalization, the non-stationary characteristics of the time series are added again, and the final prediction output is obtained. When the source load time series prediction sequence is subjected to inverse instance normalization, the calculation formula is as follows:
[0148]
[0149] Where k represents the number of variables, γk and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
[0150] Figure 3 This is a comparison chart of the predicted source load curve and the actual source load curve on the test set according to the method of this embodiment. It has been verified by experiments that the method of this embodiment can meet the prediction needs of source load data under small sample conditions by fine-tuning the large language model.
[0151] Embodiment 2
[0152] This embodiment proposes a source-load small sample time series prediction system based on a pre-trained large language model, including a microprocessor and a computer-readable storage medium connected to each other, and the microprocessor is programmed or configured to execute the source-load small sample time series prediction method based on a pre-trained large language model described in Example 1.
[0153] This embodiment further provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it can be used to execute the method described in the first embodiment.
[0154] Embodiment 3
[0155] This embodiment proposes a source-load small sample time series prediction device based on a pre-trained large language model, including:
[0156] The time prompt word encoding module is used to perform word segmentation encoding on the attributes that affect the output of the source load time series using the word segmentation query vector table of the pre-trained large language model to obtain the time prompt word encoding;
[0157] A source load time series data segmentation module is used to obtain the source load time series data, perform reversible instance normalization processing on the source load time series data, and then divide it to obtain different blocks of the source load time series data, Patches;
[0158] The position encoding module is used to establish a query vector table and perform word segmentation encoding on the word segmentation query vector table using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding, use the vector query table to perform token encoding on each block Patch, and then generate a corresponding position encoding for each token;
[0159] A source-load timing prediction module is used to add the position code and the corresponding token code and then concatenate them with the time prompt word code, then input the concatenation result into the pre-trained large language model and perform fine-tuning, and cut off the time prompt word code part in the output vector of the pre-trained large language model and obtain the source-load timing prediction sequence after processing through the output layer;
[0160] The prediction result processing module is used to perform inverse instance normalization processing on the source-load time series prediction sequence to obtain a final prediction result.
[0161] Similar to the first embodiment, in this embodiment, the attributes that affect the output of the source-load time series in the time prompt word encoding module specifically refer to the source-load time series related attributes that are different in different scenarios.
[0162] Similar to the first embodiment, in this embodiment, when the source load time series data segmentation module performs reversible instance normalization processing on the source load time series data and then divides the data, it includes:
[0163] First, the source-load time series data is subjected to reversible instance normalization processing, the steps comprising: using the mean and variance of each variable in the source-load time series data to normalize each variable, the calculation formula is as follows:
[0164]
[0165] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, and ε is a constant;
[0166] Then the normalized source-load time series data is divided, and the steps include:
[0167] The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels. Each channel is a sequence of a single variable. For each single variable sequence, the data at adjacent different time points are divided into the same block Patch.
[0168] Similar to the first embodiment, in this embodiment, when the position encoding module generates a corresponding position encoding for each marker Token in the marker Token encoding result, it includes:
[0169] The position encoding of each token is calculated using the non-learnable encoding in the form of sine and cosine in the transformer. The calculation formula is as follows:
[0170]
[0171] Among them, pos represents the position code of each token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
[0172] Similar to the first embodiment, in this embodiment, the pre-trained large language model of the source-load timing prediction module adds a low-rank adaptive LoRA fine-tuning method. When the source-load timing prediction module inputs the splicing result into the pre-trained large language model and performs fine-tuning, it includes the first stage of fine-tuning steps, specifically including:
[0173] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0174] The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process;
[0175] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0176] Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation;
[0177] Use the optimizer to update the parameters of the output layer and query vector table.
[0178] Similar to the first embodiment, in this embodiment, after the first stage fine adjustment of the source load timing prediction module, a second stage fine adjustment step is also included, which specifically includes:
[0179] In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result.
[0180] The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process;
[0181] Calculate the difference between the model output and the actual source-load time series to obtain the loss value;
[0182] Calculate the gradient of the loss value relative to the output layer, the query vector table, the low-rank adaptation LoRA low-rank fine-tuning matrix, and the layer normalization parameters in the pre-trained large language model converter Transformer structure through backpropagation;
[0183] Use the optimizer to update the output layer, query vector table, low-rank adaptation LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model converter Transformer structure.
[0184] Similar to the first embodiment, in this embodiment, the source-load timing prediction module truncates the time cue word encoding part in the output vector of the pre-trained large language model and processes it through the output layer to obtain the source-load timing prediction sequence, including:
[0185] The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain a source-load time series in the form of patches;
[0186] Through the flattening operation of the output layer, the source-load time series in the form of patches is restored to obtain the source-load time series;
[0187] The restored source-load time series is input into the linear layer of the output layer, and the output layer is deactivated by Dropout to prevent the model from overfitting.
[0188] Obtain the data after the linear layer and the dropout method to obtain the source-load time series prediction sequence.
[0189] Similar to the first embodiment, in this embodiment, when the prediction result processing module performs inverse instance normalization processing on the source-load time series prediction sequence, the calculation formula is as follows:
[0190]
[0191] Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
[0192] Embodiment 4
[0193] This embodiment proposes a computer-readable storage medium on which a computer program is stored. The program is programmed or configured to execute the source-load small sample time series prediction method based on a pre-trained large language model described in Embodiment 1 through a processor.
[0194] In summary, the present invention proposes a method, system, device and medium for predicting source-load small sample time series based on a pre-trained large language model, which has the following beneficial effects compared with the prior art:
[0195] 1. The number of independent variables that affect the output of the source-load time series, as well as the source-load time series related attributes that have certain differences in different scenarios such as sampling period, are segmented and encoded in the form of text descriptions and spliced into the input in the form of prompt word encoding, so that the model has a certain generalization ability for different types of source-load time series data, and there is no need to train a separate model for the source-load data of each scenario.
[0196] 2. Adopting the idea of transfer learning, fine-tuning is performed for the source load prediction task based on a general large language model, which fully utilizes the powerful generalization ability and rich world knowledge of the pre-trained large language model. This makes it possible to train without a large number of samples or train the model from scratch, thus meeting the needs of the source load prediction task under small sample conditions.
[0197] 3. The reversible instance normalization method is adopted. Instance normalization is performed before inputting the model to remove the unstable characteristics of the input source load data, which is convenient for the model to learn time series information and is conducive to the gradient update during model training; and reverse instance normalization is performed at the output to reintegrate the unstable information of the original data into the output to improve the accuracy of the prediction results.
[0198] 4. Patching and channel separation are used to reduce the length of the input sequence, decompose the multivariate time series into multiple single variable sequences, and improve the model's processing efficiency and prediction accuracy for source load data.
[0199] 5. The same source load data is used in both the alignment and fine-tuning stages for the source load prediction task, making full use of limited samples and adapting to the needs of small sample scenarios.
[0200] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0201] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for predicting source-load small sample time series based on a pre-trained large language model, characterized in that: The following steps are involved: The attributes that affect the output of the source-load time series are segmented and encoded using the segmentation query vector table of the pre-trained large language model to obtain the time prompt word encoding; Acquire source-load time series data, perform reversible instance normalization processing on the source-load time series data, and then divide the data to obtain different patches of the source-load time series data; Establish a query vector table and encode the words in the query vector table using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. Use the vector query table to encode tokens for each patch, and then generate corresponding position codes for each token. The position code and the corresponding token code are added and concatenated with the time cue word code, and then the concatenation result is input into the pre-trained large language model and fine-tuned, and the time cue word code part in the output vector of the pre-trained large language model is cut off and processed by the output layer to obtain the source-load time series prediction sequence; The source-load time series prediction sequence is subjected to inverse instance normalization processing to obtain a final prediction result.
2. The source-load small sample time series prediction method based on a pre-trained large language model according to claim 1 is characterized in that: The attributes affecting the output of the source-load timing sequence specifically refer to the source-load timing sequence related attributes that are different in different scenarios.
3. The source-load small sample time series prediction method based on a pre-trained large language model according to claim 1 is characterized in that: When the source-load time series data is divided after reversible instance normalization processing, the step of reversible instance normalization processing of the source-load time series data is included, including: using the mean and variance of each variable in the source-load time series data to normalize each variable, and the calculation formula is as follows: Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, and ε is a constant.
4. The source-load small sample time series prediction method based on a pre-trained large language model according to claim 1 is characterized in that: When the source-load time series data is divided after reversible instance normalization processing, the step of dividing the normalized source-load time series data includes: The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels. Each channel is a sequence of a single variable. For each single variable sequence, the data at adjacent different time points are divided into the same block Patch.
5. The source-load small sample time series prediction method based on a pre-trained large language model according to claim 1 is characterized in that: When generating the corresponding position encoding for each token in the token encoding result, it includes: The position encoding of each token is calculated using the non-learnable encoding in the form of sine and cosine in the transformer. The calculation formula is as follows: Among them, pos represents the position code of each token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
6. The source-load small sample time series prediction method based on a pre-trained large language model according to claim 1 is characterized in that: The pre-trained large language model adds a low-rank adaptive LoRA fine-tuning method. When the concatenation result is input into the pre-trained large language model and fine-tuned, the first stage of fine-tuning steps is included, specifically including: In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result. The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process; Calculate the difference between the model output and the actual source-load time series to obtain the loss value; Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation; Use the optimizer to update the parameters of the output layer and query vector table.
7. The method for predicting source-load small sample time series based on a pre-trained large language model according to claim 6, characterized in that: After the first stage of fine-tuning, the second stage of fine-tuning is also included, including: In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result. The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process; Calculate the difference between the model output and the actual source-load time series to obtain the loss value; Calculate the gradient of the loss value relative to the output layer, the query vector table, the low-rank adaptation LoRA low-rank fine-tuning matrix, and the layer normalization parameters in the pre-trained large language model converter Transformer structure through backpropagation; Use the optimizer to update the output layer, query vector table, low-rank adaptation LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model converter Transformer structure.
8. The method for predicting source-load small sample time series based on a pre-trained large language model according to claim 1, characterized in that: After the time cue word encoding part in the output vector of the pre-trained large language model is truncated and processed by the output layer to obtain the source-load time series prediction sequence, it includes: The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain a source-load time series in the form of patches; Through the flattening operation of the output layer, the source-load time series in the form of patches is restored to obtain the source-load time series; The restored source-load time series is input into the linear layer of the output layer, and the output layer is deactivated by Dropout to prevent the model from overfitting. Obtain the data after the linear layer and the dropout method to obtain the source-load time series prediction sequence.
9. The method for predicting source-load small sample time series based on a pre-trained large language model according to claim 1, characterized in that: When the source-load time series prediction sequence is subjected to inverse instance normalization processing, the calculation formula is as follows: Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
10. A source-load small sample time series prediction system based on a pre-trained large language model, characterized in that: It comprises a microprocessor and a computer-readable storage medium connected to each other, wherein the microprocessor is programmed or configured to execute the source-load small sample time series prediction method based on a pre-trained large language model as described in any one of claims 1 to 9.
11. A source-load small sample time series prediction device based on a pre-trained large language model, characterized in that: include: The time prompt word encoding module is used to perform word segmentation encoding on the attributes that affect the output of the source load time series using the word segmentation query vector table of the pre-trained large language model to obtain the time prompt word encoding; A source load time series data segmentation module is used to obtain the source load time series data, perform reversible instance normalization processing on the source load time series data, and then divide it to obtain different blocks of the source load time series data, Patches; The position encoding module is used to establish a query vector table and perform word segmentation encoding on the word segmentation query vector table using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding, use the vector query table to perform token encoding on each block Patch, and then generate a corresponding position encoding for each token; A source-load timing prediction module is used to add the position code and the corresponding token code and then concatenate them with the time prompt word code, then input the concatenation result into the pre-trained large language model and perform fine-tuning, and cut off the time prompt word code part in the output vector of the pre-trained large language model and obtain the source-load timing prediction sequence after processing through the output layer; The prediction result processing module is used to perform inverse instance normalization processing on the source-load time series prediction sequence to obtain a final prediction result.
12. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: The attributes that affect the output of the source-load time series in the time prompt word encoding module specifically refer to the source-load time series related attributes that are different in different scenarios.
13. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: When the source-load time series data segmentation module performs reversible instance normalization processing on the source-load time series data and then divides it, it includes the step of performing reversible instance normalization processing on the source-load time series data, including: using the mean and variance of each variable in the source-load time series data to normalize each variable, and the calculation formula is as follows: Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, and ε is a constant.
14. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: When the source load time series data segmentation module performs reversible instance normalization processing on the source load time series data and then divides the data, the step of dividing the normalized source load time series data includes: The vectors formed by different dimensions of the source-load time series are projected into the embedding space to form different independent channels. Each channel is a sequence of a single variable. For each single variable sequence, the data at adjacent different time points are divided into the same block Patch.
15. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: When the position encoding module generates a corresponding position encoding for each marker Token in the marker Token encoding result, it includes: The position encoding of each token is calculated using the non-learnable encoding in the form of sine and cosine in the transformer. The calculation formula is as follows: Among them, pos represents the position code of each token, p k,2i , p k,2i+1 They are the 2i and 2i+1th components of the encoding vector of the position code pos, and d is the dimension of the position vector.
16. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: The pre-trained large language model of the source-load timing prediction module adds a low-rank adaptive LoRA fine-tuning method. When the source-load timing prediction module inputs the splicing result into the pre-trained large language model and performs fine-tuning, the first stage fine-tuning steps are included, specifically including: In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result. The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process; Calculate the difference between the model output and the actual source-load time series to obtain the loss value; Compute the gradient of the loss value with respect to the parameters in the output layer and the query vector table through backpropagation; Use the optimizer to update the parameters of the output layer and query vector table.
17. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 16, characterized in that: After the first stage fine adjustment of the source-load timing prediction module, the second stage fine adjustment step is also included, specifically including: In each training batch, the word segmentation in the query vector table after the last training update is encoded using the word segmentation query vector table of the pre-trained large language model to obtain a vector query table of token encoding. The vector query table is used to perform token encoding on the source load time series data in the form of patches, and a corresponding position code is generated for each token in the token encoding result. The position code and the corresponding token code are added together and then concatenated with the time prompt word code, and then the concatenated result is input into the pre-trained large language model, and the model output is obtained through the model forward propagation process; Calculate the difference between the model output and the actual source-load time series to obtain the loss value; Calculate the gradient of the loss value relative to the output layer, the query vector table, the low-rank adaptation LoRA low-rank fine-tuning matrix, and the layer normalization parameters in the pre-trained large language model converter Transformer structure through backpropagation; Use the optimizer to update the output layer, query vector table, low-rank adaptation LoRA low-rank fine-tuning matrix, and layer normalization parameters in the pre-trained large language model converter Transformer structure.
18. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: The source-load time series prediction module removes the time cue word encoding part in the output vector of the pre-trained large language model and processes it through the output layer to obtain a source-load time series prediction sequence, including: The time cue word encoding part in the output vector of the pre-trained large language model is truncated to obtain a source-load time series in the form of patches; Through the flattening operation of the output layer, the source-load time series in the form of patches is restored to obtain the source-load time series; The restored source-load time series is input into the linear layer of the output layer, and the output layer is deactivated by Dropout to prevent the model from overfitting. Obtain the data after the linear layer and the dropout method to obtain the source-load time series prediction sequence.
19. The source-load small sample time series prediction device based on a pre-trained large language model according to claim 11, characterized in that: When the prediction result processing module performs inverse instance normalization processing on the source-load time series prediction sequence, the calculation formula is as follows: Where k represents the number of variables, γ k and β k are all learnable affine transformation parameters, is the mean of each variable, is the variance of each variable, is the variable in the source-load time series data, is the variable in the source-load time series prediction sequence, and ε is a constant.
20. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, characterized in that: The computer program is programmed or configured to execute the source-load small sample time series prediction method based on a pre-trained large language model according to any one of claims 1 to 9 through a processor.
Citation Information
Patent Citations
Method and system for coordinating interoperation and operation of power distribution system
CN116865364A
Large language model-based combat situation analysis and target action prediction method
CN118277790A
Method and apparatus for constructing dispatching model of integrated energy system, medium, and electronic device
WO2022160705A1
Cited By
Industrial equipment residual life prediction method fusing pre-training large language model
CN119272641A
Multivariable source load data prediction method and system based on pre-trained big language model
CN119377397A
Multivariate source-load data prediction method and system based on pre-trained large language model
CN119377397B
Data prediction method, prediction large model training method and related device
CN119721215A
Natural gas demand prediction method based on GPT driving mode perception segmentation matching
CN120146262A
