Power grid intelligent scheduling decision-making method, device and equipment based on retrieval enhancement generation
By extracting the text of power grid dispatching issues and using a fine-tuned pre-trained language model to query and sort from the knowledge base, the problems of model illusion and knowledge update lag in intelligent power grid dispatching are solved, and efficient and traceable intelligent dispatching decisions are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV
- Filing Date
- 2026-03-23
- Publication Date
- 2026-04-24
AI Technical Summary
There are problems such as model illusion, knowledge lag and difficulty in tracing the source of decisions in smart grid dispatch. Traditional dispatch relies on human experience, resulting in slow emergency response and poor decision consistency, which makes it difficult to meet the real-time and accuracy requirements of modern power grids.
By extracting power grid dispatching question text from dispatcher query text, using a fine-tuned pre-trained language model to query candidate knowledge text from power grid dispatching knowledge text, calculating semantic similarity and ranking, generating retrieval enhancement prompt text, and outputting a power grid intelligent dispatching decision scheme.
This enables the traceability and updability of the power grid intelligent dispatch decision-making process, reduces the risk of models generating decisions without professional knowledge, improves the relevance and efficiency of knowledge acquisition, and ensures the accuracy and reference value of decisions.
Smart Images

Figure CN121920790A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of intelligent power grid dispatching and artificial intelligence decision-making technology, and in particular to a method, apparatus and equipment for intelligent power grid dispatching decision-making based on retrieval enhancement generation. Background Technology
[0002] Against the backdrop of rapid development of new energy sources, power grid operation is complex and ever-changing. Traditional dispatching relies on human experience, resulting in slow emergency response and poor decision-making consistency, making it difficult to meet the real-time and precision requirements of modern power grids.
[0003] Currently, in smart grid dispatching, the large language model is mainly used to understand dispatcher queries, retrieve knowledge, and generate strategies. However, the general model is prone to "model illusion," generating control strategies that do not conform to reality and violate safety regulations; the decision-making process is not transparent, and the results are difficult to trace. Summary of the Invention
[0004] This application provides a method, apparatus, and equipment for intelligent power grid dispatching decision-making based on retrieval enhancement, in order to solve the problems of model illusion, knowledge update lag, and difficulty in tracing the source of decisions that are prone to occur in related technologies in intelligent power grid dispatching.
[0005] The first aspect of this application provides a method for intelligent power grid dispatching decision-making based on retrieval enhancement, comprising the following steps: extracting power grid dispatching problem text from the dispatcher's query text; inputting the power grid dispatching problem text into a fine-tuned pre-trained language model, querying a set of candidate knowledge texts from power grid dispatching knowledge texts through the fine-tuned pre-trained language model, the set of candidate knowledge texts including at least one candidate knowledge text; calculating the semantic similarity between the power grid dispatching problem text and each candidate knowledge text, ranking each candidate knowledge text according to the semantic similarity, and determining the target knowledge text from each candidate knowledge text according to the ranking result; generating retrieval enhancement prompt text from the power grid dispatching problem text and the target knowledge text, inputting the retrieval enhancement prompt text into the fine-tuned pre-trained language model, and outputting an intelligent power grid dispatching decision scheme through the pre-trained language model.
[0006] Optionally, in one embodiment of this application, before extracting the power grid dispatching problem text from the dispatcher's query text, the method further includes: obtaining power grid dispatching knowledge text from multiple data sources; generating query text, positive sample information, and negative sample information based on the power grid dispatching knowledge text; generating triples based on the query text, positive sample information, and negative sample information; constructing a fine-tuning dataset based on the triples; and fine-tuning the pre-trained language model using the fine-tuning dataset.
[0007] Optionally, in one embodiment of this application, obtaining power grid dispatch knowledge text from multiple data sources includes: collecting multi-source power grid dispatch professional knowledge data, which includes at least one of rule-driven dispatch knowledge and learning-driven dispatch knowledge; preprocessing the multi-source power grid dispatch professional knowledge data, which includes converting data of different formats into text data, cleaning and segmenting the text data, and generating power grid dispatch knowledge text.
[0008] Optionally, in one embodiment of this application, constructing a fine-tuning dataset based on triples includes: encoding the triple information using a shared encoder to obtain the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information; mapping the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information to the same vector space to obtain the query vector, the positive sample vector, and the negative sample vector; and constructing a fine-tuning dataset based on the query vector, the positive sample vector, and the negative sample vector.
[0009] Optionally, in one embodiment of this application, fine-tuning the pre-trained language model using a fine-tuning dataset includes: performing contrastive learning training on the pre-trained language model using the fine-tuning dataset; calculating the contrastive learning loss during the contrastive learning training process; updating the model parameters of the pre-trained language model through backpropagation based on the contrastive learning loss, until the semantic distance between the query text and the positive sample is less than a first distance threshold, such that the semantic distance between the query text and the negative sample is greater than a second distance threshold.
[0010] Optionally, in one embodiment of this application, the function of the contrastive learning loss is:
[0011] in, To compare the learning loss function values, For temperature hyperparameters, For query vector, For positive sample vectors, For negative sample vectors, For the first i A negative sample vector, For cosine similarity, It is the natural logarithm. It is an exponential function.
[0012] Optionally, in one embodiment of this application, after fine-tuning the pre-trained language model using the fine-tuned dataset, the method further includes: vectorizing the power grid dispatching knowledge text using the fine-tuned pre-trained language model; constructing an index structure based on the semantic vectors generated during the vectorization process; and using the index structure to perform similarity retrieval on the power grid dispatching knowledge text to obtain a set of candidate knowledge texts related to the dispatcher's query semantics.
[0013] A second aspect of this application provides a power grid intelligent dispatch decision-making device based on retrieval enhancement, comprising: an extraction module for extracting power grid dispatch problem text from a dispatcher's query text; a query module for inputting the power grid dispatch problem text into a fine-tuned pre-trained language model, and querying a set of candidate knowledge texts from power grid dispatch knowledge texts through the fine-tuned pre-trained language model, the set of candidate knowledge texts including at least one candidate knowledge text; a calculation module for calculating the semantic similarity between the power grid dispatch problem text and each candidate knowledge text, ranking each candidate knowledge text according to the semantic similarity, and determining a target knowledge text from each candidate knowledge text according to the ranking result; and a generation module for generating retrieval enhancement prompt text from the power grid dispatch problem text and the target knowledge text, inputting the retrieval enhancement prompt text into the fine-tuned pre-trained language model, and outputting a power grid intelligent dispatch decision-making scheme through the pre-trained language model.
[0014] Optionally, in one embodiment of this application, before extracting the power grid dispatching problem text from the dispatcher's query text, the method further includes: a fine-tuning module, used to obtain power grid dispatching knowledge text from multiple data sources; generate query text, positive sample information, and negative sample information based on the power grid dispatching knowledge text; generate triples based on the query text, positive sample information, and negative sample information; construct a fine-tuning dataset based on the triples; and fine-tune the pre-trained language model using the fine-tuning dataset.
[0015] Optionally, in one embodiment of this application, the fine-tuning module is further used to collect multi-source power grid dispatching professional knowledge data, which includes at least one of rule-driven dispatching knowledge and learning-driven dispatching knowledge; and to preprocess the multi-source power grid dispatching professional knowledge data, including converting data of different formats into text data, cleaning and segmenting the text data, and generating power grid dispatching knowledge text.
[0016] Optionally, in one embodiment of this application, the fine-tuning module is further configured to encode the triplet information using a shared encoder to obtain the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information; map the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information to the same vector space to obtain the query vector, the positive sample vector, and the negative sample vector; and construct a fine-tuning dataset based on the query vector, the positive sample vector, and the negative sample vector.
[0017] Optionally, in one embodiment of this application, the fine-tuning module is further configured to perform contrastive learning training on the pre-trained language model using the fine-tuning dataset; calculate the contrastive learning loss during the contrastive learning training process; and update the model parameters of the pre-trained language model through backpropagation based on the contrastive learning loss until the semantic distance between the query text and the positive sample is less than a first distance threshold, thereby making the semantic distance between the query text and the negative sample greater than a second distance threshold.
[0018] Optionally, in one embodiment of this application, the function of the contrastive learning loss is:
[0019] in, To compare the learning loss function values, For temperature hyperparameters, For query vector, For positive sample vectors, For negative sample vectors, For the first i A negative sample vector, For cosine similarity, It is the natural logarithm. It is an exponential function.
[0020] Optionally, in one embodiment of this application, after fine-tuning the pre-trained language model using the fine-tuned dataset, the method further includes: a vectorization module, used to vectorize the power grid dispatching knowledge text using the fine-tuned pre-trained language model; constructing an index structure based on the semantic vectors generated during the vectorization process; and using the index structure to perform similarity retrieval on the power grid dispatching knowledge text to obtain a set of candidate knowledge texts related to the dispatcher's query semantics.
[0021] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the program to implement the power grid intelligent dispatch decision-making method based on retrieval enhancement generation as described in the above embodiments.
[0022] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the power grid intelligent dispatch decision method based on retrieval enhancement generation as described in the above embodiments.
[0023] Therefore, this application has the following beneficial effects: First, the power grid dispatching problem text is extracted from the dispatcher's query text, forming a semantically clear and structurally standardized problem statement, providing accurate input for subsequent knowledge retrieval and decision generation. Second, the power grid dispatching problem text is input into a fine-tuned pre-trained language model, which queries a set of candidate knowledge texts from the power grid dispatching knowledge text. The candidate knowledge text set includes at least one candidate knowledge text, quickly retrieving knowledge fragments semantically related to the dispatching problem, improving the targeting and efficiency of knowledge acquisition. Then, the semantic similarity between the power grid dispatching problem text and each candidate knowledge text is calculated. The candidate knowledge texts are ranked according to semantic similarity, and the target knowledge text is determined from them. The most matching knowledge is selected, laying the foundation for generating high-quality and operable dispatching schemes. Finally, the power grid dispatching problem text and the target knowledge text are used to generate retrieval enhancement prompt text, which is then input into the fine-tuned pre-trained language model. The model outputs a smart power grid dispatching decision scheme, integrating problem and professional knowledge to achieve accurate and referable smart dispatching decisions. This enables the power grid intelligent dispatch decision-making process to be based on searchable and screenable professional knowledge, effectively reducing the risk of models generating decisions without professional knowledge. Furthermore, through knowledge base support and retrieval enhancement mechanisms, the decision basis can be traced and updated, thereby overcoming the limitations of related technologies in terms of model illusion, knowledge update lag, and decision traceability.
[0024] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0025] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of a power grid intelligent dispatch decision-making method based on retrieval enhancement generation according to an embodiment of this application; Figure 2 This is a schematic diagram illustrating the construction of a power grid dispatching question-and-answer knowledge base according to an embodiment of this application; Figure 3 This is a schematic diagram of the fine-tuning process of the embedding model based on contrastive learning according to an embodiment of this application; Figure 4 This is a schematic diagram of the two-stage retrieval and rearrangement model workflow according to an embodiment of this application; Figure 5 This is a schematic diagram of a large language model reasoning and high-performance service framework based on retrieval enhancement prompts according to an embodiment of this application; Figure 6 This is an example diagram of a power grid intelligent dispatch decision-making device based on retrieval enhancement according to an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0026] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.
[0027] The following description, with reference to the accompanying drawings, outlines a power grid intelligent dispatching decision-making method, apparatus, and device based on retrieval enhancement generation, according to embodiments of this application. To address the problems mentioned in the background, this application provides a power grid intelligent dispatch decision-making method based on retrieval enhancement. In this method, firstly, the power grid dispatch problem text is extracted from the dispatcher's query text, forming a semantically clear and structurally standardized problem statement, providing accurate input for subsequent knowledge retrieval and decision generation. Secondly, the power grid dispatch problem text is input into a fine-tuned pre-trained language model, which queries a set of candidate knowledge texts from the power grid dispatch knowledge text. The candidate knowledge text set includes at least one candidate knowledge text, quickly retrieving knowledge fragments semantically related to the dispatch problem, improving the targeting and efficiency of knowledge acquisition. Then, the semantic similarity between the power grid dispatch problem text and each candidate knowledge text is calculated. The candidate knowledge texts are ranked according to semantic similarity, and the target knowledge text is determined from them, selecting the most matching knowledge to lay the foundation for generating a high-quality, operable dispatch scheme. Finally, the power grid dispatch problem text and the target knowledge text are used to generate retrieval enhancement prompt text, which is then input into the fine-tuned pre-trained language model. The model outputs a power grid intelligent dispatch decision scheme, integrating problem and professional knowledge to achieve accurate and referable intelligent dispatch decisions. This enables the power grid intelligent dispatch decision-making process to be based on searchable and screenable professional knowledge, effectively reducing the risk of models generating decisions without professional knowledge. Furthermore, through knowledge base support and retrieval enhancement mechanisms, the decision basis can be traced and updated, thereby overcoming the limitations of related technologies in terms of model illusion, knowledge update lag, and decision traceability.
[0028] Specifically, Figure 1 This is a flowchart illustrating a power grid intelligent dispatch decision-making method based on retrieval enhancement provided in an embodiment of this application.
[0029] like Figure 1 As shown, the intelligent power grid dispatching decision-making method based on retrieval enhancement includes the following steps: In step S101, the power grid dispatching problem text is extracted from the dispatcher's query text.
[0030] Among them, the dispatcher query text is the natural language text information entered by the dispatcher during the power grid dispatching business process, which is used to describe the current power grid operating status, dispatching needs or dispatching constraints; the power grid dispatching problem text is the semantic content that is identified and extracted from the dispatcher query text and directly represents the power grid dispatching task or dispatching decision needs.
[0031] Understandably, by extracting power grid dispatching problem text from dispatcher query texts, the dispatcher's natural language input can be transformed into semantically clear and relatively standardized problem statements, providing accurate and processable input for subsequent knowledge retrieval and decision generation.
[0032] In one embodiment of this application, before extracting the power grid dispatching problem text from the dispatcher's query text, the method further includes: obtaining power grid dispatching knowledge text from multiple data sources; generating query text, positive sample information, and negative sample information based on the power grid dispatching knowledge text; generating triples based on the query text, positive sample information, and negative sample information; constructing a fine-tuning dataset based on the triples; and fine-tuning the pre-trained language model using the fine-tuning dataset.
[0033] In this application, the power grid dispatch knowledge text refers to textual information derived from multi-source power grid professional data, including standard operating procedures, professional technical documents, and learning-driven prior dispatching experience. In this application, it represents the foundational information for constructing the fine-tuning dataset and the power grid dispatch knowledge text. The query text is text generated based on the power grid dispatch knowledge text and is used to construct triples. In this application, it represents the question input in the fine-tuning dataset. Positive sample information refers to knowledge content semantically related to the query text. In this application, it represents reference text used to narrow the semantic distance during fine-tuning training. Negative sample information refers to knowledge content semantically unrelated or partially related to the query text. In this application, it represents interference text used to widen the semantic distance during fine-tuning training. The triple represents the data unit required for comparative learning fine-tuning in this application. The fine-tuning dataset is a collection of multiple triples. In this application, it represents the training data used to adjust the parameters of the pre-trained language model to adapt it to the semantic representation of the power grid dispatch domain.
[0034] Understandably, by acquiring power grid dispatch knowledge text from multiple data sources and constructing query text, positive samples, and negative sample information based on this knowledge, thereby generating triples and building a fine-tuning dataset, the pre-trained language model can fully learn the semantic features and professional knowledge of the power dispatch domain during the fine-tuning process. This helps improve the model's ability to understand and semantically distinguish power grid dispatch problems, enhances the accuracy of knowledge retrieval, and makes the dispatch decisions generated by the model more in line with actual business needs.
[0035] Specifically, this application first constructs a domain-specific dataset for fine-tuning a pre-trained language model based on acquired multi-source power grid dispatching knowledge text. The power grid dispatching knowledge text can originate from dispatching procedures, operational experience documents, historical dispatching records, and dispatching experience data generated by simulation or learning models. Based on this, query text, positive sample information, and negative sample information are generated from the power grid dispatching knowledge text. Subsequently, the query text, positive sample information, and negative sample information are combined to construct training samples in the form of triples, enabling the model to distinguish the degree of semantic association between different knowledge texts and query texts during comparative learning. By summarizing the triples, a domain-specific dataset for fine-tuning is formed. Finally, the pre-trained language model is fine-tuned using the fine-tuning dataset, enabling the model to more accurately characterize the semantic relationship between power grid dispatching problems and professional knowledge texts in the vector representation space, thereby providing a reliable model foundation for subsequent knowledge retrieval and dispatching decision generation.
[0036] In one embodiment of this application, obtaining power grid dispatch knowledge text from multiple data sources includes: collecting multi-source power grid dispatch professional knowledge data, which includes at least one rule-driven dispatch knowledge and learning-driven dispatch knowledge; preprocessing the multi-source power grid dispatch professional knowledge data, which includes converting data of different formats into text data, cleaning and segmenting the text data, and generating power grid dispatch knowledge text.
[0037] Among them, multi-source power grid dispatch professional knowledge data are power system dispatch-related data from different channels, including rule-driven dispatch knowledge and learning-driven dispatch knowledge; rule-driven dispatch knowledge is knowledge formed based on traditional power grid operation procedures and operating standards; learning-driven dispatch knowledge is dispatch experience data generated in the power grid simulation environment through methods such as reinforcement learning; text data is processable text information after unified format conversion; cleaning is the original text to be denoised, deduplicated, and semantically normalized; block processing is the text to be divided into semantically complete knowledge fragments.
[0038] Understandably, by extracting power grid dispatch expertise from multi-source data and performing unified format conversion, text cleaning, and chunking, it is possible to effectively eliminate format differences and redundant information in the original data, ensuring that each knowledge fragment contains relatively complete semantic units. This lays a solid foundation for subsequently constructing structured power grid dispatch knowledge text, improves the efficiency and accuracy of knowledge retrieval, and enables large language models to rely on high-quality, traceable expertise when generating dispatch decision schemes.
[0039] The specific process by which this application obtains power grid dispatch knowledge text from multiple data sources is as follows: Figure 2 As shown, the first step is to systematically collect and integrate professional knowledge related to power grid dispatching. This professional knowledge comes from multiple data channels, including rule-based knowledge such as dispatching procedures, standardized operating processes, and various professional technical documents accumulated over a long period, as well as learning-based knowledge such as dispatching experience data obtained through repeated interaction and trial and error in a power grid simulation environment using reinforcement learning models.
[0040] Because the data differs in source, structure, and storage format, a unified preprocessing operation is performed after acquiring the raw data to convert the data of different formats into a unified text format. Subsequently, the text data is cleaned to remove noise and irrelevant content, and then processed in blocks according to the principle of semantic integrity, so that each piece of text corresponds to a relatively independent and complete scheduling knowledge unit.
[0041] Through the above processing steps, a set of power grid dispatch knowledge texts with clear structure and explicit semantics is finally formed. This set is then further constructed into a power grid dispatch knowledge base that can be used for subsequent semantic retrieval and intelligent reasoning, providing stable and reliable knowledge support for the subsequent dispatch decision-making process based on a large language model.
[0042] In one embodiment of this application, constructing a fine-tuning dataset based on triples includes: encoding triple information using a shared encoder to obtain the encoding of query text, the encoding of positive sample information, and the encoding of negative sample information; mapping the encoding of query text, the encoding of positive sample information, and the encoding of negative sample information to the same vector space to obtain query vector, positive sample vector, and negative sample vector; and constructing a fine-tuning dataset based on the query vector, positive sample vector, and negative sample vector.
[0043] In this application, the shared encoder is a weight-sharing text encoding model used to map query text, positive sample information, and negative sample information to a unified vector space. The query vector is a high-dimensional vector representation obtained by encoding the query text through the shared encoder, representing the semantic representation of the query text in the vector space. The positive sample vector is a high-dimensional vector representation obtained by encoding the positive sample information through the shared encoder, representing the semantic representation of the positive sample in this application. The negative sample vector is a high-dimensional vector representation obtained by encoding the negative sample information through the shared encoder, representing the semantic representation of the negative sample in this application.
[0044] Understandably, by encoding and mapping triplet information to a unified vector space to construct a fine-tuning dataset, the query text can form a clear and distinguishable semantic relationship with positive and negative samples in the vector space, thus providing high-quality, structured training samples for subsequent contrastive learning fine-tuning. This step can significantly enhance the semantic representation capability of the pre-trained language model in the field of power grid dispatching, enabling the model to more accurately understand the subtle semantic differences in dispatching problems, improve the accuracy and relevance of knowledge retrieval, and lay a solid foundation for generating reliable and professional dispatching decisions.
[0045] The specific implementation process of constructing a fine-tuning dataset based on triples in this application is attached. Figure 3 As shown, based on the aforementioned multi-source power grid dispatching knowledge text, a triplet data structure is first constructed, consisting of query text, positive sample information, and negative sample information. The query text is used to represent the dispatcher's problem expression in actual business scenarios. The positive sample information is power grid dispatching knowledge text that is highly relevant to the query semantics, while the negative sample information is knowledge text that is irrelevant or has low relevance to the query semantics. This ensures that the fine-tuned data can truly reflect the semantic differentiation requirements in power grid dispatching operations.
[0046] Building upon this, a shared-parameter encoder encodes the query text, positive sample information, and negative sample information in the triples, generating corresponding query text codes, positive sample codes, and negative sample codes. Since the encoder shares the network structure and model parameters across different inputs, it ensures the comparability of different text types within a unified semantic space. Subsequently, the query text codes, positive sample codes, and negative sample codes are mapped to the same vector space, forming query vectors, positive sample vectors, and negative sample vectors, respectively.
[0047] During training, the similarity relationships between the query vector and positive sample vectors, and between the query vector and negative sample vectors, are modeled. A contrastive learning loss function is introduced to continuously narrow the semantic distance between the query vector and positive sample vectors, while simultaneously increasing the semantic distance between the query vector and negative sample vectors during optimization. The model parameters of the shared encoder are updated through backpropagation, gradually enhancing the model's ability to discriminate semantic differences in the power grid dispatching domain. After multiple rounds of training, the resulting fine-tuned dataset and corresponding embedding model form a vector representation space with higher semantic discriminativeness, thus providing fundamental support for high-precision semantic retrieval of power grid dispatching knowledge.
[0048] In this embodiment, the pre-trained language model before fine-tuning is an autoregressive generative model based on the Transformer architecture, which includes a multi-layer decoder structure for contextual modeling of the input text and generating corresponding inference output results. The pre-trained language model is pre-trained using a large-scale general corpus, possessing basic natural language understanding and generation capabilities, and can be further adapted using domain data to meet the inference needs of power grid dispatching scenarios.
[0049] The pre-trained language model employs a decoder-based Transformer network structure, comprising multiple stacked self-attention sublayers and feedforward neural network sublayers. The self-attention sublayers model the contextual dependencies between positions in the input sequence, while the feedforward neural network sublayers perform non-linear mapping on the attention output. Layers are connected via residual connections and normalization to improve model training stability. The feedforward neural network sublayers utilize non-linear activation functions with gating mechanisms to enhance the model's ability to express complex semantic features. The model introduces a positional information injection mechanism based on rotational position encoding, enabling it to maintain good sequential modeling capabilities under long sequence conditions.
[0050] The pre-trained language model is optimized using autoregressive language modeling during the training phase. Its training objective is to predict subsequent text units based on known context. The training corpus includes multilingual natural language text, code text, and text related to logical reasoning to improve the model's general understanding and reasoning capabilities. During training, the original text data undergoes cleaning, word segmentation, encoding, and sequence truncation or padding to meet the model's input length requirements. The model parameters are updated using gradient backpropagation during training, combined with learning rate scheduling and parameter regularization strategies to improve training convergence and generalization ability. The pre-trained language model consists of multiple neural network layers, with the number of layers, hidden state dimensions, and attention heads configured according to the model's scale requirements. It should be noted that the pre-trained language model framework before the fine-tuning is only used as a general language model for performing reasoning tasks.
[0051] In one embodiment of this application, fine-tuning a pre-trained language model using a fine-tuning dataset includes: performing contrastive learning training on the pre-trained language model using the fine-tuning dataset; calculating the contrastive learning loss during the contrastive learning training process; updating the model parameters of the pre-trained language model through backpropagation based on the contrastive learning loss, until the semantic distance between the query text and the positive sample is less than a first distance threshold, such that the semantic distance between the query text and the negative sample is greater than a second distance threshold.
[0052] In this application, contrastive learning training is a supervised learning paradigm that enables the model to learn to distinguish different semantics by minimizing the semantic distance between the query and positive samples and maximizing the semantic distance between the query and negative samples. The contrastive learning loss is the objective function for optimization during contrastive learning training, and in this application, it is used to quantify the similarity difference between the query vector and the positive and negative sample vectors. The model parameters are iteratively updated using the backpropagation algorithm to optimize the contrastive learning loss. Semantic distance is a measure of the semantic difference of text in the vector space, and in this application, it is calculated using cosine similarity. The first distance threshold is a preset upper limit of the semantic distance between the query text and the positive sample vector, used to guide model convergence. The second distance threshold is a preset lower limit of the semantic distance between the query text and the negative sample vector, used to ensure semantic discriminability.
[0053] Understandably, by using a fine-tuning dataset to perform comparative learning fine-tuning on the pre-trained language model, this application enables the model to form a more accurate semantic representation in the field of power grid dispatching, and improves the model's ability to distinguish the semantic relationship between dispatching problems and professional knowledge. By optimizing the model parameters through backpropagation, it ensures that the semantic distance between the query text and positive samples is as close as possible, while the semantic distance between the query text and negative samples is as far apart as possible, thereby enhancing the accuracy and reliability of knowledge retrieval.
[0054] In one embodiment of this application, when fine-tuning the pre-trained language model using a fine-tuning dataset, a contrastive learning training method is employed to optimize the model's discriminative ability in the semantic representation task of power grid dispatching. The core objective of this contrastive learning training is to make the vector representation corresponding to the query text semantically closer to the vector representation corresponding to its positive sample in the same vector space, while maintaining a high degree of semantic distinguishability with the vector representation corresponding to the negative sample.
[0055] Specifically, to quantify the semantic similarity between different text vectors, this embodiment uses cosine similarity as a similarity metric to measure the directional consistency between any two vectors. The calculation formula is as follows:
[0056] in, For cosine similarity, For query vector, Positive or negative samples are used for comparison with the query text. To query the modulus of the vector, The model is either a positive sample or a negative sample.
[0057] By normalizing the magnitude of the vector dot product, the obtained similarity result is limited to the range of [-1, 1], where the larger the value, the higher the degree of similarity between the corresponding texts in the semantic space.
[0058] In this embodiment, during the contrastive learning training process, a contrastive learning loss is calculated based on the query vector, positive sample vector, and negative sample vector. This allows the model to continuously increase the similarity between the query vector and the positive sample vector while decreasing the similarity between the query vector and the negative sample vector. Subsequently, based on the contrastive learning loss, the model parameters of the pre-trained language model are iteratively updated using the backpropagation algorithm until a preset convergence condition is met: the semantic distance between the query text and the positive sample is less than a first distance threshold, while the semantic distance between the query text and the negative sample is greater than a second distance threshold. This completes the model fine-tuning for the power grid dispatching domain. The first and second distance thresholds are pre-set threshold parameters and are not specifically limited.
[0059] In one embodiment of this application, the function of the contrastive learning loss is:
[0060] in, To compare the learning loss function values, For temperature hyperparameters, For query vector, For positive sample vectors, For negative sample vectors, For the first i A negative sample vector, For cosine similarity, It is the natural logarithm. It is an exponential function.
[0061] Understandably, by employing a temperature-based loss function to maximize the semantic similarity between the query vector and the positive sample vector, while minimizing the semantic similarity between the query vector and the negative sample vector, this application can effectively improve the discriminability of semantic representations in the embedding space. The introduction of the temperature hyperparameter τ allows this application to flexibly adjust the penalty for difficult negative samples, strengthening the model's ability to perceive fine-grained semantic differences. Through optimization, the pre-trained language model in this application's embodiments can more accurately identify and select knowledge fragments highly relevant to the scheduling problem when faced with superficially similar but semantically unrelated candidate knowledge texts, thereby significantly improving the accuracy of subsequent knowledge retrieval and the reliability and professionalism of intelligent scheduling decision-making schemes.
[0062] To achieve the training objective—namely, ensuring that the semantic distance between the query text and positive samples in the vector space is less than a first distance threshold, and the semantic distance between the query text and negative samples is greater than a second distance threshold—this application employs a loss function (such as a noise contrastive estimation loss function) as the core objective function for optimizing the embedding model. The loss function constructs the training task as a classification problem, enabling the model to perform training on a given query vector. In the case of the corresponding positive sample vector and multiple negative sample vectors Accurately identify positive samples from the set.
[0063] During the training process, this application introduces a temperature hyperparameter. The cosine similarity score is scaled. A temperature coefficient adjusts the sharpness of the probability distribution: a lower temperature coefficient results in a sharper distribution. The value makes the model pay more attention to difficult-to-distinguish negative samples during training, thereby enhancing the model's sensitivity to subtle semantic differences. The specific form of the loss function incorporating the temperature coefficient is as follows:
[0064] During training, this invention employs an optimizer to minimize the aforementioned loss function (such as an adaptive factor optimizer) and iteratively updates the weights of the shared encoder using a backpropagation algorithm. This iterative process continuously optimizes the vector space structure, making the distribution of query vectors, positive sample vectors, and negative sample vectors more reasonable in the embedding space, with semantically similar samples more closely packed and semantically disseminated samples more dispersed, thereby improving the accuracy of subsequent knowledge retrieval. After multiple rounds of training and optimization, a pre-trained language model deeply adapted to power dispatching business scenarios is finally obtained, capable of providing high-quality, distinguishable semantic representations for power grid dispatching problems, and providing a solid data foundation for subsequent intelligent dispatching decisions.
[0065] In one embodiment of this application, after fine-tuning the pre-trained language model using the fine-tuned dataset, the method further includes: vectorizing the power grid dispatching knowledge text using the fine-tuned pre-trained language model; constructing an index structure based on the semantic vectors generated during the vectorization process; and using the index structure to perform similarity retrieval on the power grid dispatching knowledge text to obtain a set of candidate knowledge texts related to the dispatcher's query semantics.
[0066] In this application, the fine-tuned pre-trained language model represents a language model with enhanced semantic understanding and professional knowledge adaptation capabilities; vectorization represents mapping text information to a vector space for subsequent retrieval; semantic vectors are high-dimensional vectors representing the semantic content of knowledge texts, and in this application, they represent data representations that can be used to measure text semantic similarity; the index structure is a retrieval structure that organizes and stores semantic vectors in a vector space, and in this application, it represents a vector database or index system that can be used for efficient similarity retrieval; similarity retrieval is a retrieval process that calculates the semantic closeness between the query text and the knowledge text based on semantic vectors, and in this application, it represents the operation of obtaining the knowledge text most relevant to the scheduler's query semantics; the candidate knowledge text set is a set of knowledge texts that are semantically related to the query text and are retrieved through the index structure, and in this application, it represents a set of knowledge fragments that can be used for subsequent sorting and generation.
[0067] Understandably, by using a fine-tuned pre-trained language model to initialize the knowledge text and mapping the text to semantic vectors, the information in the power grid dispatch knowledge text can be effectively quantified and measured in the vector space. Constructing an index structure and performing similarity retrieval can efficiently and accurately obtain the set of candidate knowledge texts most relevant to the dispatcher's query semantics. This process not only improves the speed and accuracy of knowledge retrieval but also ensures that the subsequently generated intelligent dispatch decision scheme can closely rely on professional knowledge.
[0068] In step S102, the power grid dispatch problem text is input using a fine-tuned pre-trained language model. The fine-tuned pre-trained language model is then used to query a set of candidate knowledge texts from the power grid dispatch knowledge text. The set of candidate knowledge texts includes at least one candidate knowledge text.
[0069] Understandably, this application achieves accurate understanding of query semantics by inputting the dispatcher's power grid scheduling problem text into a finely tuned pre-trained language model, and efficiently retrieves a set of candidate knowledge texts from the knowledge base, ensuring that the retrieval results are highly relevant to the scheduling problem, thus providing a reliable and professional knowledge foundation for subsequent fine-tuning and decision generation.
[0070] In the initial retrieval (coarse recall) phase, upon receiving a query from a dispatcher, this application inputs the text of the power grid dispatching issue into a finely tuned pre-trained language model. This model, acting as a retrieval engine, can quickly filter out a set of candidate knowledge documents semantically relevant to the query from the power grid dispatching knowledge text. Each set contains at least one candidate knowledge document, thus providing a preliminary and accurate knowledge fragment foundation for subsequent fine-tuning and decision generation.
[0071] In step S103, the semantic similarity between the power grid dispatch problem text and each candidate knowledge text is calculated, each candidate knowledge text is sorted according to the semantic similarity, and the target knowledge text is determined from each candidate knowledge text according to the sorting result.
[0072] Semantic similarity is an indicator used to measure the degree of semantic closeness between two texts. In this application, it represents the semantic matching degree between the power grid dispatching problem text and the candidate knowledge text. The target knowledge text is the knowledge text that is most semantically relevant to the power grid dispatching problem text after being sorted and filtered in the candidate knowledge text set. In this application, it represents the key knowledge fragment used to generate retrieval enhancement prompts.
[0073] Understandably, this application calculates the semantic similarity between the power grid scheduling problem text and each candidate knowledge text, and ranks the candidate knowledge texts based on the similarity. This enables the accurate identification of the knowledge text that best matches the scheduling problem from a large number of retrieval results. This not only improves the accuracy of knowledge selection, but also effectively reduces the noise input in the subsequent large language model generation process.
[0074] In the second stage of fine-ranking, this application inputs the candidate knowledge document set returned from the initial retrieval in the first stage into the re-ranking model. The re-ranking model, through in-depth semantic interaction analysis of the query text and each candidate document, can more accurately assess the relevance between the query and the document. Subsequently, based on the evaluation results, the candidate documents are fine-ranked to determine the target knowledge document that best matches the current power grid dispatching problem, providing reliable knowledge support for the subsequent generation of high-quality dispatching decisions.
[0075] The rearrangement model used in this application adopts a Transformer decoder structure, which includes multiple stacked self-attention sub-layers and feedforward neural network sub-layers. Information is transmitted between the layers through residual connections and normalization to achieve joint modeling of deep semantic associations between query text and candidate text.
[0076] In its implementation, the reordering model concatenates the query text and candidate knowledge text according to a preset input template and inputs them into the same encoding structure. It then models the contextual dependencies between different text fragments through a causal self-attention mechanism, thereby obtaining a semantic representation or relevance score that reflects the degree of matching between the query text and the candidate knowledge text.
[0077] To adapt to the requirements of the reordering task, the reordering model has a projection layer at the output end, which is used to map the high-dimensional hidden state into a low-dimensional semantic vector or scalar score result for ranking calculation, so as to support the relevance ranking of multiple candidate knowledge texts.
[0078] The training process of the rearrangement model includes the following steps: A training sample set containing query text, positive sample knowledge text, and negative sample knowledge text is constructed. The text data is cleaned, segmented, and encoded, and the input sequence for the model is constructed according to a preset format. The input sequence is then fed into the reordering model to obtain the model's prediction results on the relevance between the query text and different candidate knowledge texts. A ranking loss function is constructed based on the supervision signal to constrain the relevance difference between positive and negative samples, and the model parameters are iteratively updated through the backpropagation algorithm. During the training process, an optimization algorithm with weight decay is adopted, combined with learning rate scheduling and gradient constraint strategies to improve the stability and generalization ability of the model training.
[0079] In summary, the two-stage retrieval process of this application embodiment is as follows: Figure 4 As shown: In step S201, the query statement or keywords entered by the user to obtain relevant information constitute the user query.
[0080] In step S202, this application performs a preliminary search based on the user query, generating a preliminary search result, i.e., a list of candidate documents, denoted as D1, D2, ..., Dk. These documents are extracted from the database using basic search methods (such as keyword matching) and may be related to the user query.
[0081] In step S203, the user query and each candidate document are concatenated according to a preset input template and then input into the reordering model. The reordering model obtains the contextual dependency between the query text fragment and the candidate document fragment through a causal self-attention mechanism, thereby obtaining a semantic representation that reflects the degree of matching. At the output end, the semantic representation is mapped to a scalar score result for ranking calculation through a projection layer. The scalar score result is the relevance score between the user query and the corresponding candidate document.
[0082] In step S204, the candidate document list is reordered to generate a rearranged result, denoted as D3, D1, D5, ... The new list is sorted from high to low according to the relevance of the documents to the user query, aiming to provide a document order that better meets the user's needs.
[0083] In step S205, the rearranged list of candidate documents is fed into the large language model to construct a context with a higher signal-to-noise ratio.
[0084] Through the two-stage retrieval process described above, this embodiment of the application can first quickly filter out candidate documents related to the user's query, and then optimize the document order through deep semantic reordering, thereby significantly improving the accuracy and matching degree of knowledge retrieval. Finally, the reordered highly relevant documents serve as context input for fine-tuning the pre-trained language model, providing reliable support for generating accurate and operable intelligent scheduling decisions.
[0085] In step S104, the power grid dispatch problem text and the target knowledge text are used to generate retrieval enhancement prompt text. The retrieval enhancement prompt text is then input into the fine-tuned pre-trained language model, and the power grid intelligent dispatch decision scheme is output through the pre-trained language model.
[0086] Among them, the enhanced retrieval prompt text is an input prompt generated by combining the power grid dispatch problem text and the target knowledge text. In this application, it represents a text format that provides complete contextual information to the fine-tuned pre-trained language model. The intelligent power grid dispatch decision scheme is a dispatch strategy or operation scheme generated by the fine-tuned pre-trained language model based on the enhanced retrieval prompt text. In this application, it represents a decision result that can directly assist dispatchers in making decisions on power grid operation control.
[0087] Understandably, this application, by fusing the power grid dispatch problem text with the selected target knowledge text to generate enhanced retrieval prompt text, and inputting it into a finely tuned pre-trained language model, can fully utilize the model's reasoning ability while ensuring that the generated content is closely based on professional knowledge. This improves the accuracy and professionalism of decision-making schemes, enhances the interpretability and credibility of output results, and enables dispatchers to quickly obtain high-quality, actionable intelligent dispatch suggestions under complex power grid operating conditions, significantly improving the efficiency and safety of power grid dispatch.
[0088] In this embodiment, to generate the final power grid dispatching scheme and ensure system performance, the target knowledge text obtained through two sorting processes is first combined with the power grid dispatching problem text to construct an information-rich retrieval enhancement prompt text, such as a RAG (Retrieval-Augmented Generation) prompt. This retrieval enhancement prompt text combines the problem with highly relevant professional knowledge, forming contextual information that can be directly used for model inference. Then, the retrieval enhancement prompt text is input into a fine-tuned pre-trained language model. The fine-tuned pre-trained language model performs comprehensive inference based on the professional knowledge contained in the prompt and the query intent, generating a logically clear, referable, and power dispatching safety-compliant intelligent dispatching decision scheme. The specific process of the high-performance batch inference service framework of this application is shown in the appendix. Figure 5 As shown.
[0089] The workflow of the power grid intelligent dispatch decision-making method based on retrieval enhancement is based on power grid dispatch knowledge text, which stores various types of information related to power grid dispatch, including dispatch rules, historical dispatch records, equipment information and operating parameters, providing data support for subsequent knowledge retrieval and reasoning.
[0090] During the operation of this application, a batch of scheduling queries will be generated first, usually represented in the form of Q1, Q2, ..., Qn.
[0091] Next, this application performs rapid processing on each query through preliminary retrieval. The power grid dispatching problem text is input and a finely tuned pre-trained language model is used to query a set of candidate knowledge texts from the power grid dispatching knowledge text. The set of candidate knowledge texts includes at least one candidate knowledge text, aiming to narrow down the data scope for subsequent processing and improve retrieval efficiency. Based on this, each candidate knowledge text is finely ranked according to semantic similarity, and the target knowledge text is selected to ensure the accuracy and reliability of knowledge matching.
[0092] Subsequently, this application integrates the refined target knowledge text with the power grid scheduling problem text in a standardized format to construct RAG (Rapid Algorithm Group) prompts. After the prompts are constructed, a pre-trained language model performs high-performance inference on the batch of prompts, generating corresponding scheduling strategy suggestions based on contextual information and queries.
[0093] Finally, this application organizes and outputs the scheduling strategies generated by the pre-trained language model, presenting them to dispatchers in a clear and readable form for reference or direct application to automated scheduling. The generated strategy results will also be saved for historical record tracing, strategy evaluation, and optimization, providing continuous and intelligent decision support for power grid dispatching.
[0094] According to the power grid intelligent dispatch decision-making method based on retrieval enhancement proposed in this application, firstly, the power grid dispatch problem text is extracted from the dispatcher's query text, which can form a semantically clear and structurally standardized problem statement, providing accurate input for subsequent knowledge retrieval and decision generation. Secondly, the power grid dispatch problem text is input into a fine-tuned pre-trained language model, which queries a set of candidate knowledge texts from the power grid dispatch knowledge text. The set of candidate knowledge texts includes at least one candidate knowledge text, quickly retrieving knowledge fragments semantically related to the dispatch problem, improving the targeting and efficiency of knowledge acquisition. Then, the semantic similarity between the power grid dispatch problem text and each candidate knowledge text is calculated, and the candidate knowledge texts are sorted according to the semantic similarity. The target knowledge text is then determined, and the most matching knowledge is selected, laying the foundation for generating a high-quality and operable dispatch scheme. Finally, the power grid dispatch problem text and the target knowledge text are used to generate retrieval enhancement prompt text, which is input into the fine-tuned pre-trained language model. The model outputs a power grid intelligent dispatch decision scheme, integrating the problem and professional knowledge to achieve accurate and referable intelligent dispatch decisions. This enables the power grid intelligent dispatch decision-making process to be based on searchable and screenable professional knowledge, effectively reducing the risk of models generating decisions without professional knowledge. Furthermore, through knowledge base support and retrieval enhancement mechanisms, the decision basis can be traced and updated, thereby overcoming the limitations of related technologies in terms of model illusion, knowledge update lag, and decision traceability.
[0095] Next, referring to the accompanying drawings, a power grid intelligent dispatching decision-making device based on retrieval enhancement generation is described according to an embodiment of this application.
[0096] Figure 6 This is a block diagram of a power grid intelligent dispatch decision-making device based on retrieval enhancement according to an embodiment of this application.
[0097] like Figure 6 As shown, the power grid intelligent dispatch decision-making device 10 based on retrieval enhancement includes: an extraction module 100, a query module 200, a calculation module 300, and a generation module 400.
[0098] The system comprises the following modules: an extraction module 100, used to extract power grid dispatching problem text from the dispatcher's query text; a query module 200, used to input the power grid dispatching problem text into a fine-tuned pre-trained language model, and use the fine-tuned pre-trained language model to query a set of candidate knowledge texts from the power grid dispatching knowledge text, the set of candidate knowledge texts including at least one candidate knowledge text; a calculation module 300, used to calculate the semantic similarity between the power grid dispatching problem text and each candidate knowledge text, sort each candidate knowledge text according to the semantic similarity, and determine the target knowledge text from each candidate knowledge text according to the sorting result; and a generation module 400, used to generate retrieval enhancement prompt text from the power grid dispatching problem text and the target knowledge text, input the retrieval enhancement prompt text into the fine-tuned pre-trained language model, and output a power grid intelligent dispatching decision scheme through the pre-trained language model.
[0099] In one embodiment of this application, it further includes: a fine-tuning module, used to obtain power grid scheduling knowledge text from multiple data sources before extracting the power grid scheduling problem text from the dispatcher's query text; generate query text, positive sample information and negative sample information based on the power grid scheduling knowledge text; generate triples based on the query text, positive sample information and negative sample information; construct a fine-tuning dataset based on the triples; and fine-tune the pre-trained language model using the fine-tuning dataset.
[0100] In one embodiment of this application, the fine-tuning module is further used to collect multi-source power grid dispatching professional knowledge data, which includes at least one of rule-driven dispatching knowledge and learning-driven dispatching knowledge; and to preprocess the multi-source power grid dispatching professional knowledge data, which includes converting data of different formats into text data, cleaning and segmenting the text data, and generating power grid dispatching knowledge text.
[0101] In one embodiment of this application, the fine-tuning module is further configured to encode the triplet information using a shared encoder to obtain the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information; map the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information to the same vector space to obtain the query vector, the positive sample vector, and the negative sample vector; and construct a fine-tuning dataset based on the query vector, the positive sample vector, and the negative sample vector.
[0102] In one embodiment of this application, the fine-tuning module is further configured to perform contrastive learning training on the pre-trained language model using the fine-tuning dataset; calculate the contrastive learning loss during the contrastive learning training process; and update the model parameters of the pre-trained language model through backpropagation based on the contrastive learning loss until the semantic distance between the query text and the positive sample is less than a first distance threshold, thereby making the semantic distance between the query text and the negative sample greater than a second distance threshold.
[0103] In one embodiment of this application, the function of the contrastive learning loss is:
[0104] in, To compare the learning loss function values, For temperature hyperparameters, For query vector, For positive sample vectors, For negative sample vectors, For the first i A negative sample vector, For cosine similarity, It is the natural logarithm. It is an exponential function.
[0105] In one embodiment of this application, it further includes: an initialization module, configured to vectorize power grid dispatching knowledge text using the fine-tuned pre-trained language model after fine-tuning the pre-trained language model using the fine-tuned dataset; construct an index structure based on the semantic vectors generated during the vectorization process; and perform similarity retrieval on the power grid dispatching knowledge text using the index structure to obtain a set of candidate knowledge texts related to the dispatcher's query semantics.
[0106] It should be noted that the foregoing explanation of the embodiment of the power grid intelligent dispatch decision method based on retrieval enhancement also applies to the power grid intelligent dispatch decision device based on retrieval enhancement in this embodiment, and will not be repeated here.
[0107] According to the power grid intelligent dispatch decision-making device based on retrieval enhancement proposed in this application, firstly, the power grid dispatch problem text is extracted from the dispatcher's query text, which can form a semantically clear and structurally standardized problem statement, providing accurate input for subsequent knowledge retrieval and decision generation. Secondly, the power grid dispatch problem text is input into a fine-tuned pre-trained language model, which queries a set of candidate knowledge texts from the power grid dispatch knowledge text. The set of candidate knowledge texts includes at least one candidate knowledge text, quickly retrieving knowledge fragments semantically related to the dispatch problem, improving the targeting and efficiency of knowledge acquisition. Then, the semantic similarity between the power grid dispatch problem text and each candidate knowledge text is calculated, and the candidate knowledge texts are sorted according to the semantic similarity. The target knowledge text is then determined, and the most matching knowledge is selected, laying the foundation for generating a high-quality and operable dispatch scheme. Finally, the power grid dispatch problem text and the target knowledge text are used to generate retrieval enhancement prompt text, which is input into the fine-tuned pre-trained language model. The model outputs a power grid intelligent dispatch decision scheme, integrating the problem and professional knowledge to achieve accurate and referable intelligent dispatch decisions. This enables the power grid intelligent dispatch decision-making process to be based on searchable and screenable professional knowledge, effectively reducing the risk of models generating decisions without professional knowledge. Furthermore, through knowledge base support and retrieval enhancement mechanisms, the decision basis can be traced and updated, thereby overcoming the limitations of related technologies in terms of model illusion, knowledge update lag, and decision traceability.
[0108] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include: The memory 701, the processor 702, and the computer program stored on the memory 701 and executable on the processor 702.
[0109] When the processor 702 executes the program, it implements the power grid intelligent dispatch decision-making method based on retrieval enhancement provided in the above embodiments.
[0110] Furthermore, electronic devices also include: Communication interface 703 is used for communication between memory 701 and processor 702.
[0111] The memory 701 is used to store computer programs that can run on the processor 702.
[0112] The memory 701 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage.
[0113] If the memory 701, processor 702, and communication interface 703 are implemented independently, then the communication interface 703, memory 701, and processor 702 can be interconnected via a bus to complete communication between them. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0114] Optionally, in a specific implementation, if the memory 701, processor 702, and communication interface 703 are integrated on a single chip, then the memory 701, processor 702, and communication interface 703 can communicate with each other through an internal interface.
[0115] The processor 702 may be a CPU (Central Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of this application.
[0116] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described intelligent power grid dispatching decision-making method based on retrieval enhancement generation.
[0117] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0118] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0119] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.
[0120] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (FPGAs), field-programmable gate arrays (FPGAs), etc.
[0121] Those skilled in the art will understand that all or part of the steps of the methods implementing the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.
[0122] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A power grid intelligent dispatching decision-making method based on retrieval enhancement generation, characterized in that, Includes the following steps: Extract the power grid dispatching problem text from the dispatcher's query text; The power grid dispatching problem text is input into a fine-tuned pre-trained language model, and the fine-tuned pre-trained language model is used to query a set of candidate knowledge texts from the power grid dispatching knowledge text. The set of candidate knowledge texts includes at least one candidate knowledge text. Calculate the semantic similarity between the power grid scheduling problem text and each candidate knowledge text, sort each candidate knowledge text according to the semantic similarity, and determine the target knowledge text from each candidate knowledge text according to the sorting result; The power grid dispatching problem text and the target knowledge text are used to generate retrieval enhancement prompt text. The retrieval enhancement prompt text is then input into the fine-tuned pre-trained language model, and the power grid intelligent dispatching decision scheme is output through the pre-trained language model.
2. The power grid intelligent dispatching decision-making method based on retrieval enhancement generation according to claim 1, characterized in that, Before extracting the power grid dispatching problem text from the dispatcher's query text, the following is also included: Obtain power grid dispatching knowledge texts from multiple data sources; Generate query text, positive sample information, and negative sample information based on the power grid dispatch knowledge text; generate triples based on the query text, positive sample information, and negative sample information; and construct a fine-tuning dataset based on the triples. The pre-trained language model was fine-tuned using the fine-tuning dataset.
3. The power grid intelligent dispatch decision-making method based on retrieval enhancement generation according to claim 2, characterized in that, The acquisition of power grid dispatch knowledge text from multiple data sources includes: Collect multi-source power grid dispatching professional knowledge data, which includes at least one rule-driven dispatching knowledge and learning-driven dispatching knowledge; The multi-source power grid dispatching professional knowledge data is preprocessed, including converting data of different formats into text data, cleaning and segmenting the text data, and generating the power grid dispatching knowledge text.
4. The power grid intelligent dispatch decision-making method based on retrieval enhancement generation according to claim 2, characterized in that, The step of constructing the fine-tuning dataset based on the triples includes: A shared encoder is used to encode the triplet information to obtain the encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information; The encoding of the query text, the encoding of the positive sample information, and the encoding of the negative sample information are mapped to the same vector space to obtain the query vector, the positive sample vector, and the negative sample vector; The fine-tuning dataset is constructed based on the query vector, the positive sample vector, and the negative sample vector.
5. The power grid intelligent dispatch decision-making method based on retrieval enhancement generation according to claim 2, characterized in that, The fine-tuning of the pre-trained language model using the fine-tuning dataset includes: The pre-trained language model was trained using the fine-tuned dataset through comparative learning. Calculate the contrastive learning loss during the contrastive learning training process, and update the model parameters of the pre-trained language model based on the contrastive learning loss through backpropagation until the semantic distance between the query text and the positive sample is less than a first distance threshold, so that the semantic distance between the query text and the negative sample is greater than a second distance threshold.
6. The power grid intelligent dispatching decision-making method based on retrieval enhancement generation according to claim 5, characterized in that, The function of the contrastive learning loss is: in, To compare the learning loss function values, For temperature hyperparameters, For query vector, For positive sample vectors, For negative sample vectors, For the first i A negative sample vector, For cosine similarity, It is the natural logarithm. It is an exponential function.
7. The power grid intelligent dispatch decision-making method based on retrieval enhancement generation according to claim 2, characterized in that, After fine-tuning the pre-trained language model using the fine-tuning dataset, the process also includes: The power grid scheduling knowledge text is vectorized using the fine-tuned pre-trained language model. An index structure is constructed based on the semantic vectors generated during the vectorization process. The index structure is then used to perform similarity retrieval on power grid dispatching knowledge texts to obtain a set of candidate knowledge texts that are semantically related to the dispatcher's query.
8. A smart grid dispatching decision-making device based on retrieval enhancement generation, characterized in that, include: The extraction module is used to extract power grid dispatching problem text from the dispatcher's query text; The query module is used to input the power grid dispatching problem text into a fine-tuned pre-trained language model, and query a set of candidate knowledge texts from the power grid dispatching knowledge text through the fine-tuned pre-trained language model. The set of candidate knowledge texts includes at least one candidate knowledge text. The calculation module is used to calculate the semantic similarity between the power grid scheduling problem text and each candidate knowledge text, sort each candidate knowledge text according to the semantic similarity, and determine the target knowledge text from each candidate knowledge text according to the sorting result; The generation module is used to generate retrieval enhancement prompt text from the power grid dispatch problem text and the target knowledge text, input the retrieval enhancement prompt text into the fine-tuned pre-trained language model, and output the power grid intelligent dispatch decision scheme through the pre-trained language model.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the power grid intelligent dispatch decision method based on retrieval enhancement generation as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the power grid intelligent dispatch decision method based on retrieval enhancement generation as described in any one of claims 1-7.
Citation Information
Patent Citations
Online intelligent question answering method and device based on instruction fine tuning and retrieval enhancement generation
CN117688163A
Power grid dispatching query method and system, computer equipment, readable storage medium and program product
CN119066085A
Knowledge question-answering system based on large language model
CN119396975A
Power field knowledge question and answer optimization system based on large model retrieval enhancement generation and instruction supervision fine tuning
CN119961388A
Large model knowledge retrieval enhancement method and related system oriented to power dispatching field
CN121092584A