CN118070901A - Method, device, medium and program product for LLM to implement power defect description reasoning - Google Patents

Method, device, medium and program product for LLM to implement power defect description reasoning Download PDF

Info

Publication number
CN118070901A
CN118070901A CN202410166221.XA CN202410166221A CN118070901A CN 118070901 A CN118070901 A CN 118070901A CN 202410166221 A CN202410166221 A CN 202410166221A CN 118070901 A CN118070901 A CN 118070901A
Authority
CN
China
Prior art keywords
defect
power
description
reasoning
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410166221.XA
Other languages
Chinese (zh)
Inventor
杨虹
孟晓凯
芦竹茂
白洋
韩钰
俞华
刘永鑫
赵亚宁
张娜
卫世超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Electric Power Research Institute Of Sepc
Original Assignee
State Grid Electric Power Research Institute Of Sepc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Electric Power Research Institute Of Sepc filed Critical State Grid Electric Power Research Institute Of Sepc
Priority to CN202410166221.XA priority Critical patent/CN118070901A/en
Publication of CN118070901A publication Critical patent/CN118070901A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, equipment, medium and program product for realizing power defect description reasoning by a large language model LLM, wherein the method comprises the following steps: receiving an input power defect description; generating an intermediate reasoning step conforming to a predetermined logic relationship by using a CoT prompt designed in advance for the power defect description field; the LLM identifies the defect severity degree to which the received power defect description belongs according to the intermediate reasoning step and the corresponding relation between the preset power defect description and the defect severity degree, and deduces the basis for making identification and/or the reasoning path for making identification; the LLM outputs the identified defect severity and outputs the basis for making the identification and/or the inferential path for making the identification. By utilizing the technical scheme, the multi-step reasoning task is assisted LLMs by the COT technology, so that the reasoning capability of LLMs in the field of power defect description is improved, and the complex problem can be more accurately understood and solved.

Description

Method, device, medium and program product for LLM to implement power defect description reasoning
Technical Field
The invention relates to the technical fields of computer science and natural language processing, in particular to a method, equipment, medium and program product for realizing power defect description reasoning by a large-scale language model LLM.
Background
In the field of power, and in particular in the field of power equipment maintenance and defect description, accurate problem identification, reasoning and text classification are of paramount importance. Conventional methods typically involve human experts or specially developed rule engines, which are problematic in that they rely on domain-specific expertise and extensive manual work. The advent of Large Language Models (LLM) has created new opportunities for this area because they are able to understand and generate natural language text, with strong text classification and reasoning capabilities.
However, LLMs faces some challenges in addressing issues in the field of power defect descriptions. First, these problems often require multi-step reasoning, which is complicated by the single input-output structure of LLMs. Second, the power domain has its specific terms and knowledge, requiring models to understand and use this specific information. Finally, power defect descriptions often require a high degree of accuracy and interpretability, as it relates to the operation and personnel safety of the power equipment.
Thus, there is a problem in the power industry how to improve the reasoning ability of LLM in power defect descriptions.
Disclosure of Invention
Embodiments of the present invention provide a method, apparatus, medium, and program product for implementing power defect description reasoning by a large language model LLM, which improves the reasoning ability of the LLM by a thought chain CoT to improve the answer quality of the LLM for power defect description input, resulting in more efficient results.
In order to achieve the above object, in one aspect, a method for LLM to implement power defect description reasoning is provided, which is characterized by comprising:
Receiving an input power defect description;
generating an intermediate reasoning step conforming to a predetermined logic relationship by using a CoT prompt designed in advance for the power defect description field;
the LLM identifies the defect severity degree to which the received power defect description belongs according to the intermediate reasoning step and the corresponding relation between the preset power defect description and the defect severity degree, and deduces the basis for making the identification and/or the reasoning path for making the identification;
the LLM outputs the identified severity of the defect and outputs a basis for making the identification and/or an inference path for making the identification.
Preferably, the method further comprises:
generating an intermediate reasoning step conforming to a predetermined logic relationship by using a CoT prompt designed in advance for the electric power defect description field and applying an automatic CoT algorithm; and/or the number of the groups of groups,
The LLM is evaluated using a pre-collected test dataset, the evaluation including evaluating identification accuracy and consistency of intermediate reasoning steps.
Preferably, the method, wherein the power defect description includes a question for a power defect, the method further comprising:
the method comprises the steps of predefining the problems to be solved in the field of power defect description, wherein the problems to be solved comprise: identifying a severity of the power defect and inferring a cause of the power defect;
pre-collecting structured, semi-structured, and/or unstructured data related to a power defect, the structured and/or unstructured data related to a power defect comprising: a description of the power device, the description of the power device including a description of the power defect, a problem classification criterion, and/or an example of an inference path;
Carrying out knowledge extraction on the collected data in advance, defining a body, and constructing a triplet (h, r, t) of a knowledge graph in the electric power defect description field, wherein h is a head entity, r is a relation between the head entity and the tail entity, and t is a tail entity; the body comprises at least defect content, defect properties and classification basis, wherein the defect properties describe the severity of the defect, and the classification basis describes the basis for identifying the defect content as corresponding defect severity;
The CoT prompt aiming at the electric power defect description field is designed in advance based on the constructed triples and the knowledge graph.
Preferably, the method further comprises, before defining the ontology, a step of preprocessing the collected data, the preprocessing comprising:
data cleansing, wherein the data cleansing comprises deduplication;
marking the data after data cleaning;
word segmentation is carried out on the data after the marking treatment;
And converting the data after word segmentation into structured data.
Preferably, the method, wherein the relationship between the head and tail entities comprises:
Power or line type-power station or line, power station or line-voltage class, power station or line-defect phenomenon, defect attribute-defect phenomenon, defect location-device component, device component-defect phenomenon, defect location-defect description, defect description-defect phenomenon, device type-defect device, defect device-device component type, and/or device component type-device component.
Preferably, the method, wherein the step of generating the intermediate inference step conforming to the predetermined logic relationship using the CoT hint pre-designed for the power defect description domain comprises:
Analyzing a description of the received power defect description for a problem and directing the LLM to generate one or more inference steps related to the problem description using a first hint phrase contained in the CoT hint, the first hint phrase for introducing a cause of occurrence of the problem;
Introducing an analysis of the severity of the problem using a second prompt phrase contained in the CoT prompt;
a solution and/or suggestion is introduced using a third hint phrase included in the CoT hint.
Preferably, the method, wherein comprises one or more of the following:
For the collected structured data, a rule-based rapid keyword extraction algorithm RAKE is adopted to conduct knowledge extraction;
For the collected semi-structured data, knowledge extraction is performed using a pre-built syntax tree;
for the collected unstructured data, knowledge extraction was performed using the BERT-BiLSTM-CRF model.
In another aspect, an electronic device is provided that includes a memory storing at least one program that is executed by a processor to implement a method as described in any of the above.
In yet another aspect, a computer readable storage medium having stored therein at least one program that is executed by a processor to implement a method as described in any of the above.
In a further aspect, a computer program product is provided, comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method as described in any of the preceding claims.
The technical scheme has the following technical effects:
The technical scheme of the embodiment of the invention improves a large language model LLM based on a CoT framework, and utilizes a CoT technology to assist LLMs in executing multi-step reasoning tasks, including generating intermediate reasoning steps; the improvement is helpful to improve the reasoning capability of LLMs in the field of electric power defect description, so that the complicated problem can be more accurately understood and solved;
Further, according to the technical scheme provided by the embodiment of the invention, the CoT prompt is applied to the problem classification and answer generation stage, so that the text classification accuracy of LLM is improved; so that LLM can more accurately identify or classify power defect descriptions into different severity levels, where in one implementation, the severity levels are differentiated by severity level, thereby providing more powerful decision support;
further, by using the COT hints to generate intermediate reasoning steps, the interpretability of the model is improved; the practitioner and the decision maker can more clearly understand the decision making process of the LLM and better understand the basis of problem solving; thus improving the performance of LLM in the field of power defect description, such as improving the processing efficiency and accuracy, and providing a more accurate, efficient and interpretable solution for the power industry.
Drawings
FIG. 1 is a flowchart illustrating a method for LLM to perform power defect description reasoning according to an embodiment of the present invention;
FIG. 2 is an algorithm diagram of a method architecture according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an example algorithm of the architecture of the method according to an embodiment of the present invention;
FIG. 4 is an ontology diagram illustrating an exemplary power defect description field according to an embodiment of the present invention;
FIG. 5 is a flow chart of knowledge extraction for data with different degrees of structuring in a method according to an embodiment of the present invention;
FIG. 6 is an example of extraction of entities and relationships of semi-structured text in a method according to an embodiment of the invention;
FIG. 7 is an example of power industry rules used in reasoning in a method of an embodiment of the invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
For further illustration of the various embodiments, the invention is provided with the accompanying drawings. The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments and together with the description, serve to explain the principles of the embodiments. With reference to these matters, one of ordinary skill in the art will understand other possible embodiments and advantages of the present invention. The components in the figures are not drawn to scale and like reference numerals are generally used to designate like components.
A mental chain (CoT, chain of Thought) as a multi-step inference technique can help LLMs handle multi-step inference questions, enabling it to generate coherent intermediate inference steps from the question descriptions. In solving the technical problems of the present invention, the inventors of the present invention have found that designing a CoT hint specific to the power defect description domain can help LLM to better understand domain-specific problems and generate relevant inference paths.
The invention will now be further described with reference to the drawings and detailed description.
Embodiment one:
Fig. 1 is a flowchart of a method for LLM to implement power defect description reasoning according to an embodiment of the present invention. As shown in fig. 1, the method for implementing power defect description reasoning by LLM of this embodiment includes the following steps:
S1, receiving input power defect description;
in one particular implementation, the power defect descriptions include defect descriptions for a power device;
In one implementation, the power defect description includes a problem for the power defect, such as a problem to be solved for the power defect; illustratively, such as identifying the severity of the power defect and inferring the cause of the power defect;
s2, generating an intermediate reasoning step conforming to a preset logic relationship by using a CoT prompt designed in advance for the electric power defect description field;
In a specific implementation, using a CoT prompt designed in advance for the power defect description field, generating an intermediate reasoning step conforming to a preset logic relationship by using an automatic CoT algorithm;
In a specific implementation, using a pre-designed CoT hint for the power defect description domain, the step of generating an intermediate inference that meets a predetermined logical relationship includes:
Analyzing descriptions of the received power defect descriptions for problems and directing the LLM to generate one or more inference steps related to the description of the problem using a first hint phrase contained in the CoT hint, the first hint phrase being used to introduce a cause of occurrence of the problem;
Using a second prompt phrase contained in the CoT prompt to introduce an analysis of the severity of the problem;
introducing solutions and/or suggestions using a third hint phrase contained in the CoT hint;
wherein the first prompt phrase, the second prompt phrase and the third prompt phrase may use any phrase or sentence having the corresponding actions or functions described above;
S3, the LLM identifies the defect severity degree to which the received power defect description belongs according to the intermediate reasoning step and the preset corresponding relation between the power defect description and the defect severity degree, and deduces the basis for identification and/or the reasoning path for identification;
In one embodiment, the severity of the defect is identified by a predetermined severity level; LLM classifies the power defect descriptions by text classification into different defect severity levels, such as different severity levels, for example, but not by way of limitation, with "general", "severe" or "urgent" etc. identifying the different defect severity levels;
s4, the LLM outputs the identified defect severity, and outputs the basis for making the identification and/or the reasoning path for making the identification.
In one embodiment, LLM is evaluated using a pre-collected test dataset, the evaluation including evaluation of recognition accuracy and consistency of intermediate reasoning steps. Actual power defect description reasoning is performed using LLMs that were trained in advance and passed through the evaluation.
In one embodiment, the CoT prompt is designed by constructing a triplet of power defect description domain knowledge maps; the triads are obtained by knowledge extraction through pre-collected power defect related data; the body at least comprises defect content, defect properties and classification basis, wherein the defect properties describe the severity of the defect, and the classification basis describes the basis for identifying the defect content as corresponding to the severity of the defect.
Knowledge graph construction and knowledge extraction are helpful for the LLM to better understand relevant information of power equipment and defects. The comprehensive application of the knowledge graph and the CoT technology aims to improve the performance of LLMs in the field of power defect description, so that more effective fault detection and maintenance support is provided for the power industry.
Embodiment two:
FIG. 2 is a schematic diagram of an architecture algorithm of a method according to an embodiment of the invention. As shown in fig. 2, the method of this embodiment adopts an automatic CoT algorithm to cluster the N problems a priori, and obtain K clustered core problems; k is smaller than N; the K core questions and corresponding answers are used as a priori knowledge input to the LLM. In this embodiment, the triplet in the knowledge graph is used to characterize question and answer pairs. Then using a priori question and answer pairs, describing the input defect, wherein the defect description comprises questions to be answered, such as test questions, and then LLM outputs corresponding answers by using a priori knowledge and through context reasoning, and the method comprises the following steps: the severity of the defect, and the cause and/or inferential path from which the severity of the defect was inferred.
FIG. 3 is a schematic diagram of an example algorithm of the architecture of the method according to an embodiment of the present invention. In comparison with fig. 2, fig. 3 shows a specific power defect description example, including an example of a problem as a priori knowledge and an example of a problem to be actually judged, in which the corresponding problem is "please determine a defect level of the phenomenon, a) generally B) seriously C) significant", and the power defect description to be finally judged for the defect level is "Q: according to the provided information, the flange at the lower part of the main transformer mailbox is checked to find that oil leakage exists, the oil drop rate is 1 drop per minute, and the oil level is normal. Please determine the defect level of the phenomenon, a) typically B) severely C) significant). After LLM reasoning improved based on the automatic CoT algorithm, which is disclosed by the embodiment of the invention, is used, a judgment result is output, and the judgment result comprises the following steps: for the answer to the "please determine defect level of the phenomenon, a) general B) serious C) major" question, as in fig. 3, "defect level of the phenomenon is a) general. The answer is a) general. The answer is A' and the basis and reasoning path for the answer is derived. As shown in figure 3, the basis and reasoning path for obtaining the answer is that the check finds that oil leakage exists at the flange at the lower part of the main transformer mailbox, the oil drop rate is 1 drop per minute, and the oil level is normal. This means that there is a small amount of oil leakage and the oil level is still normal. "
In order to implement the algorithm architecture of the above embodiment, compared to the method of the first embodiment, the method of the first embodiment of the present invention further includes:
The problems to be solved in the field of power defect description are predefined, and include: identifying a severity of the power defect and inferring a cause of the power defect;
The method comprises the steps of pre-collecting structured, semi-structured and/or unstructured data related to power defects, wherein the structured and/or unstructured data related to power defects comprises: a description of the power device, a problem classification criterion, and/or an example of an inference path, the description of the power device including a description of a power defect;
Carrying out knowledge extraction on the collected data in advance, defining a body, and constructing a triplet (h, r, t) of a knowledge graph in the electric power defect description field, wherein h is a head entity, r is a relation between the head entity and the tail entity, and t is a tail entity; the body at least comprises defect content, defect properties and classification basis, wherein the defect properties describe the severity of the defect, and the classification basis describes the defect content as the basis of the severity of the corresponding defect; in a specific implementation, before defining the ontology, the method further includes a step of preprocessing the collected data, where the preprocessing includes: data cleaning, wherein the data cleaning comprises de-duplication; marking the data after data cleaning; word segmentation is carried out on the data after the marking treatment; converting the data after word segmentation into structured data;
CoT prompts for the power defect description field are designed in advance based on the constructed triples and the knowledge graph.
A specific implementation of this embodiment of the invention is described in detail below.
Step1: problem definition and data collection;
First, the problem to be solved is defined explicitly. In the field of power defect description, problems include: classifying or identifying the severity of the power defect, deducing the cause of the power equipment defect and/or giving a corresponding reasoning path, etc. Structured, semi-structured and/or unstructured data sets related to power defects are collected and consolidated. These data include: description of the power equipment, problem classification criteria, and expert-provided examples of the inference path.
Step 2: preprocessing data;
data cleaning is carried out on the collected data set, data cleaning, marking and word segmentation are carried out on unstructured data such as information of the power main equipment, and structured data is obtained through conversion;
Data cleansing includes data deduplication to ensure that the data set does not contain the same information, thereby reducing redundancy; then, data marking is carried out, and unstructured original text information is converted into structured data so that a computer can understand and process the structured data; this may include identifying key information for device type, defect level, defect basis, etc.; then, word segmentation is carried out on the data, and the text information is split into words or phrases so as to facilitate subsequent text analysis and processing; and finally, splitting the data, and converting the data after cleaning, marking and word segmentation into structured data for the model.
This process can effectively extract useful information so that the LLM can better understand the status and defects of the power devices, thereby enabling accurate classification and inference.
Step 3: defining a body, and constructing a triplet and a knowledge graph;
Using the collected data, such as power grid main equipment data, carrying out entity pattern design of a knowledge graph body in advance based on conventional knowledge in the electric power field, such as table header content and habit of an electric power system, and constructing triples (h, r and t) of the knowledge graph, wherein h is a head entity, r is a relation, and t is a tail entity;
The relationships that exist between entities include: power or line type-power station or line, power station or line-voltage class, power station or line-defect phenomenon, defect attribute-defect phenomenon, defect location-device component, device component-defect phenomenon, defect location-defect description, defect description-defect phenomenon, device type-defect device, defect device-device component type, and/or device component type-device component, etc.
Preferably, when the power knowledge graph is constructed, the entities are not classified so as to ensure the cognitive reasoning effect;
Preferably, after the construction of the triples is completed, nodes in which the number of occurrences is less than 3 are removed.
Fig. 4 is an ontology diagram illustrating an exemplary power defect description field according to an embodiment of the present invention. In fig. 4, each box represents an ontology. Fig. 4 is merely exemplary, and in other implementations, there may be more or fewer ontologies.
Step 4: designing a CoT Prompt (Prompt) specific to the power defect field by combining the knowledge graph;
each question has a reasonable reasoning path to properly guide LLM to perform multi-step reasoning tasks, including intermediate reasoning steps.
In a specific implementation, information such as a defect level, a defect basis, defect content and the like is extracted by combining triplets of a knowledge graph, and problems such as classification or identification of severity of a power defect, inference of a cause of the power equipment defect and/or giving out a corresponding inference path are generated by combining triplets, and an intermediate inference step is generated in a large language model by using an automatic CoT, namely an automatic thought chain (Auto-CoT, auto Chain of Thought), so that performance of a complex inference task is improved.
The basic idea of Auto-CoT is to use a simple hint, such as "Let' S THINK STEP by step" to guide the language model to answer questions in a logical chain.
The main steps of Auto-CoT are as follows:
first, a given set of questions is clustered, and similar questions are separated into different clusters.
Then, for each cluster, a question is randomly selected as a representative, and an inference chain is generated using a prompt "let us think step by step" as a demonstration example.
Finally, for other questions in each cluster, the language model is guided to generate answers using the corresponding presentation examples.
The algorithm flow of Auto-CoT is as follows
Where Q is the question set, K is the number of clusters, Q i is the ith question, c i is the ith cluster center, d i ith presentation example, a i is the ith answer.
The mathematical formula for Auto-CoT is as follows:
Problem clustering: the problem is clustered after vectorization by using a k-means algorithm, and the objective function is that
Where C i is the i-th cluster and C i is the i-th cluster center.
Demonstration sampling: for each cluster C i, a question q i∈Ci is randomly selected as a representative and a "let us think step by step" hint is used to generate an inference chain d i=(s1,s2,…,sn)di=(s1,s2,…,sn), where s j is the j-th inference step.
And (3) reasoning generation: for the other questions q e C i\{qi in each cluster C i, the corresponding presentation example d i=(s1,s2,…,sn) is used to guide the language model to generate the answer a= (t 1,t2,…,tn), where t j=P(sj∣q,di) is the jth reasoning step generated from the questions and presentation examples.
Step 5: intermediate reasoning step generation
In this step, the designed CoT hint is used to generate an intermediate reasoning step. These steps should be coherent, connecting the question description with the answer.
An intermediate reasoning step is generated with the designed CoT prompt to ensure consistency between the question description and the answer, i.e. the answer. First, a description of the problem is analyzed and key phrases in the CoT hint, such as "due", are used to identify the cause of the problem. The large language model is then guided to generate reasoning steps related to the problem description to explain the cause of the problem. These steps should be mutually linked to clearly present the underlying logic of the problem. Next, the use of phrases like "problem likely to result" introduces analysis related to the severity of the problem to ensure that the model can gradually deduce the severity of the problem. Finally, we are guided by "to ensure proper operation of the device and personnel safety", proposing solutions and suggestions that ensure that the intermediate reasoning steps remain consistent with the background and domain relevance of the problem. Through the intermediate reasoning steps, the question description and the answer can be better connected, so that the large language model can more accurately execute multi-step reasoning tasks.
Those skilled in the art will recognize that the use of the above phrases "due to", "problem may result in" and "to ensure proper operation and personnel safety of the device" are exemplary, and that other phrases or sentences may be used that serve the same purpose.
Step 6: question classification and answer generation
Based on the intermediate reasoning step generated LLMs performs a text classification task, determining the severity of the power defect. Then LLMs generates the final answer.
Based on the intermediate reasoning step generated, the Large Language Model (LLMs) performs a text classification task to determine the severity of the power defect. LLMs, using the generated reasoning steps as a basis, compares the description of the power defect with predefined severity level criteria. By analyzing the information in the intermediate reasoning step LLMs, the nature and potential impact of the power defect can be deduced step by step, accurately classifying it as "general", "severe" or "urgent". This text classification task allows LLMs to make reasonable classification decisions based on the description of the problem and intermediate reasoning steps, improving the accuracy and consistency of the power defect description. Through this step, we can apply LLMs's reasoning ability to the power defect domain, providing accurate classification and important decision support for staff.
Specific algorithm flow
LLM processes the inference flow as feature vectors, using a nonlinear function called the Softmax function (Softmax function), to map linear combinations of arguments to a probability vector representing the probability of each class. The Softmax function is given by
Where y i is the i-th class label, x is the feature variable, w i,wj,bi and b j are parameters to be estimated, where i represents the current i-th class label, j is the index variable used for traversal summation, and K is the number of classes. The goal of logistic regression is to find a set of parameters such that the predicted probability vector is as close as possible to the actual class label. This can be achieved by maximizing a log-likelihood function (log-likelihood function) with the formula: )
Where l (w, b) is the maximum log likelihood function with parameters w and b as arguments, x i is the ith feature variable and n is the number of data points. The log likelihood function may be solved by a gradient descent (GRADIENT DESCENT) optimization algorithm. The loss function is mainly divided into two parts: a masked language model (MLM, masked Language Model) loss function and an in-sentence prediction (NSP, next Sentence Prediction) loss function. The total loss function of the model is a weighted sum of two-part loss functions, namely:
Total loss=MLM loss+α*NSP loss;
wherein alpha is a super parameter, which is preset or manually adjusted.
Step 7: model performance assessment
The performance of LLMs is evaluated, including accuracy, text classification accuracy, and consistency of intermediate reasoning steps. In one implementation, test data sets are used to evaluate LLMs performance in the field of power defect descriptions.
To evaluate the performance of a Large Language Model (LLMs) in the field of power defect descriptions, a test dataset is used for comprehensive evaluation, including accuracy, text classification accuracy, and consistency of intermediate reasoning steps. The method of evaluation involves a confusion matrix, the following are the main steps of evaluation:
Text classification accuracy assessment: the performance of the model, including the precision (P), recall (R) and F1 values as evaluation indices, was recorded using a confusion matrix, which was calculated from the confusion matrix, and the confusion matrix of the classification result was shown in the table.
1) P refers to the proportion of samples predicted positive by the classifier and predicted correctly to all samples predicted positive, and the calculation formula is as follows:
2) R refers to the proportion of the samples predicted to be positive and correct by the classifier to all the samples truly positive, and the calculation formula is as follows:
3) F1 is a comprehensive index of P and R, and the general calculation formula is as follows:
Continuity evaluation of intermediate reasoning steps: finally, the consistency of the intermediate reasoning steps generated by LLMs is evaluated. This includes checking LLMs whether the generated inference steps are consistent to ensure that they can clearly link the question descriptions and answers. The consistency assessment may be by a manual assessment or an automatic assessment method, for example using natural language processing tools to check for logical consistency between the inference steps.
Through the confusion matrix and the corresponding evaluation indexes, the performance of LLMs in the field of power defect description can be comprehensively known, the effectiveness and feasibility of the verification method are realized, and better decision support and problem solving are provided for power industry staff. These evaluation methods help ensure that the model provides accurate and consistent results in multi-step reasoning tasks and text classification tasks.
A specific example of reasoning about the input power defect descriptions and outputting the results using the method of the embodiment of the present invention is given below. In the example, examples of model input and model output are respectively given for the two conditions of prompt and no prompt; the fact that a triplet is presented in the prompted input and the fact that a triplet is not presented in the non-prompted input. The output formats of the LLM model differ accordingly for both inputs.
Model input with prompt:
You are an expert in the grid field and i will provide you with some triplet facts about the problem, the earlier triples are more relevant to the problem, you need to analyze the following problems in combination with these facts and give answer and reasoning paths to the following problems.
The gas pressure of SF6 of the 110kV side 116 switch of the suburb transformer #2 reaches 0.45MPa, the pressure reaches an alarm value ',' defect classification ',' serious ',' suburb transformer 110kV North west I-line 115 switch SF6 reaches 0.45MPa, alarm value ',' classification basis ',' eighteenth (table 11) 2.1SF6 gas leakage according to the national grid company 'high-voltage switch equipment operation Specification', 'alarm signal qualitative serious defect', 'subsubsuburb transformer 110kV 110 SF6 gas pressure reaches 0.45MPa, alarm value', 'classification basis', 'pressure gauge indicates abnormality'
Description of power defects: SF6 gas pressure alarm is carried out by 110kV suburb 110kV Huang Xian switch, the pressure reaches an alarm value (rated pressure value is 0.6Mpa, alarm pressure value is 0.55Mpa, locking pressure value is 0.50Mpa, and site gas pressure value is 0.53)
You need to take the power knowledge as the main, combine the triplet facts, determine which of general, serious, critical, and give the cause. Your reply format should be as follows: * Defect grade of defect is x. The reasons are 1,2,3, and the treatment can be performed in modes 1,2, 3.
Model output with prompt:
according to historical data II, the SF6 gas pressure of a 110kV suburb 110kV west Huang Xian 185 switch reaches an alarm value, and according to the rule of the eighteenth strip (Table 11) of the national electric network company 'high-voltage switch equipment operation Specification', the SF6 gas pressure reaches the alarm value, the method belongs to a serious defect.
Inference path:
The defect levels are: severe.
1. According to the national grid company specifications, when SF6 gas pressure reaches an alarm value, the system belongs to a serious defect.
2. According to the description of the first historical data, the SF6 gas pressure of the 110kV side 116 switch of the suburban transformer #2 reaches an alarm value, and the method belongs to a serious defect.
3. In summary, the defect grade of the defect is severe.
The treatment method comprises the following steps:
according to the specification of the national power grid company, for the condition that the SF6 gas pressure reaches the alarm value, the following modes can be adopted for processing:
1. SF6 gas is supplemented to restore the pressure to within the normal range.
2. The switch is maintained or replaced to ensure proper operation of the device.
3. And (3) performing gas pressure inspection and equipment operation state monitoring, and timely finding and solving the problem that the pressure abnormality can be caused.
The defect grade of the defect is severe according to the above analysis. The reason is that SF6 gas pressure reaches an alarm value, equipment operation is possibly unstable, potential safety hazards exist, and corresponding treatment measures need to be taken in time.
Model input without hint:
you are an expert in the grid field, please give an answer to the following question.
Description of power defects: SF6 gas pressure alarm is carried out by 110kV suburb 110kV Huang Xian switch, the pressure reaches an alarm value (rated pressure value is 0.6Mpa, alarm pressure value is 0.55Mpa, locking pressure value is 0.50Mpa, and site gas pressure value is 0.53)
Determine which of general, serious, critical, and cause the defect. Your reply format should be as follows: * Defect grade of defect is x. The reasons are 1,2,3, and the treatment can be performed in modes 1,2, 3.
Model output without hint:
From the given problem description, the following inference path can be derived:
The defect levels are: generally, the method is used for the treatment of a disease.
1. According to the alarm pressure value of 0.55Mpa and the on-site gas pressure value of 0.53Mpa, the gas pressure is close to the alarm value, but not yet reaches the locking pressure value.
2. Based on a given nominal pressure value of 0.6Mpa, it can be assumed that the alarm pressure and the lock-out pressure are such as to ensure that the plant is operating within a safe pressure range.
3. Since the gas pressure exceeds the alarm value but does not reach the locking pressure value, it can be judged that the defect belongs to the common defect.
In summary, the defect grade of the defect is general. Possible causes include gas leakage, equipment aging or improper operation, etc. To address this deficiency, the following approach may be taken:
1. The inspection and check device has the place of gas leakage, especially the place related to gas sealing, such as valve, pipeline, etc.
2. If a leakage point is found, the damaged part is repaired or replaced in time.
3. And (5) performing equipment maintenance and overhaul to ensure that the normal running state of the equipment and the gas pressure are within a safe range.
4. Operators are trained to improve their knowledge of the proper functioning of the equipment to avoid gas pressure problems caused by improper operation.
The above is preliminary analysis and reasoning according to given information, and the specific processing method also needs to make specific judgment and take measures according to actual conditions.
In the method of the embodiment of the invention, when preprocessing the collected data, in a specific implementation, knowledge extraction is performed by using different algorithms to extract corresponding entities and relations when processing structured, semi-structured and unstructured data. As shown in fig. 5, for the collected structured data, knowledge extraction is performed using a rule-based fast keyword extraction algorithm, RAKE; for the collected semi-structured data, knowledge extraction is performed using a pre-built syntax tree; for the collected unstructured data, knowledge extraction was performed using the BERT-BiLSTM-CRF model.
The following specific steps for data preprocessing in implementation of the method of this embodiment are described as follows:
1. Data preprocessing and statistics
The collected power data comprises PMS equipment attribute data of a power company, operation and maintenance reports, maintenance records, fault logs, technical documents, standard manuals, webpage data and the like. Cleaning is carried out. This includes operations such as removing stop words, removing HTML tags, removing special characters and punctuation marks, processing missing values, removing duplicate data, and the like. The processed text data can be better classified, corpus labeling and the like.
After data cleaning is completed, a series of methods such as word bag construction, feature representation, feature dimension reduction, cluster analysis and the like are used for carrying out statistical analysis, and then extraction technology suitable for related data is selected.
2. Structured data
For structured data such as database tables, excel, JSON, CSV, etc. obtained directly from the grid company database, we employ a rule-based fast keyword extraction algorithm RAKE because of the well-defined rules and structure of such data. Through the algorithm, the method can be rapidly applied to data extraction without complicated model training process, so that the cost can be effectively reduced, and the information extraction with high accuracy can be ensured.
3. Semi-structured data
Semi-structured data obtained from grid companies, including operation and maintenance reports, maintenance records, fault logs, etc., are subject to specific writing rules. Although there are certain rules for such data, it is not quite sufficient. If knowledge extraction is performed by adopting a manual construction rule mode, the accuracy is low, and a large amount of human resources are required to be input. Thus, the project selection employs the BERT-Tree-LSTM model to more efficiently process semi-structured data. By fully utilizing rule information in the data, the grammar tree is designed, so that the model can be more flexibly adapted to the specific structure of the data, the accuracy of knowledge extraction is improved, and the labor cost is reduced.
4. Unstructured data
For unstructured data, such as webpage information including hundreds of degrees encyclopedia, blogs, news and the like, and power information including meeting records, power reports, technical manuals and the like. Because such unstructured data lacks explicit, predefined patterns or structures, while containing rich semantic information, traditional rule-based, statistical approaches are not applicable. The project thus uses the BERT-BiLSTM-CRF model, which performs better in handling context-sensitive tasks. It is able to capture contextual information of words, understand the context of words throughout the text. And in the training stage, a large amount of labeling information is adopted, and efficient entity extraction is completed by training the BERT-BiLSTM-CRF model.
And finally obtaining the entities and relations related to the power grid from the data.
For example after construction of the syntax tree
In the early stage of research, large-scale semi-structure data is needed first, so that a grammar tree is conveniently constructed.
Corpus sample example:
Excessive transformer oil temperatures [ { "sentence": "can lead to equipment damage. "tokens" [ "transformer", "oil temperature", "too high", "possible", "resulting", "equipment", "damage", ". "POS_tags" [ "n", "n", "a", "d", "v", "n", "v", "w" ] }, a.
2. Grammar analysis model training:
① Model selection: a pre-training model based on the power grid domain data is selected, a BERT model is used, and a pre-training model specific to the power grid domain is used.
② Data preprocessing: and performing word segmentation and part-of-speech tagging on sentences in the corpus, and considering the technical terms in the power grid field.
③ Construction of a parse tree: using the dependency syntax analyzer, a dependency syntax tree is constructed for each sentence, including the dependencies between words.
④ Model input representation: the word segmentation and the part-of-speech tagging are converted into input representations which can be understood by a model, including professional vocabulary in the power grid field.
⑤ Model architecture: by means of the feature extraction capability of the pre-training model BERT, an LSTM network, namely a Tree-LSTM, is constructed through dependency syntax Tree information. The word vector of each word is subjected to sequence modeling through the LSTM, and the hidden state of the LSTM is updated in a targeted manner by utilizing the dependency relationship information in the syntax tree. And capturing semantic information again, constructing a neural network model, and designing a dependency syntax analysis layer by combining domain knowledge so as to better adapt to the grammar structure in the power grid domain.
⑥ Training data preparation: the training set and the testing set are divided, so that the diversity and the specificity of the power grid equipment are ensured to be covered.
⑦ Model training: model training is performed on the training set, and model parameters are adjusted by minimizing the loss function.
Model evaluation:
⑧ Test data preparation: and performing model performance evaluation by using a test set in the field of power grids.
⑨ Performance index: the performance of the model on the test set is evaluated, focusing on whether the grammar structure can be accurately captured in the power grid field.
⑩ Analysis of results: the performance of the model in describing power grid equipment faults, maintenance and the like is analyzed to determine the adaptability and practicality of the model.
3. Model optimization:
① Domain specific adjustment: and further adjusting the model according to the performance evaluation result to better adapt to the grammar structure in the power grid field.
② The technical terms complement: if desired, a domain glossary may be introduced to enhance the model's understanding of the grid's specific vocabulary.
Extraction of entities and relationships of the semi-structured text is finally achieved, as shown in fig. 6.
In the implementation of the method of the embodiment of the invention, the LLM uses expert examples/criteria in the implementation of reasoning; the specific uses are:
In the above example ('suburban transformer #2 main transformer 110kV side 116 switch SF6 gas pressure is 0.45MPa, the pressure reaches an alarm value', 'classification basis', 'pressure gauge indicates abnormal'), the classification basis is provided by an expert, and the matching of the classification basis is performed through BERT. And the explanatory property and the accuracy of the text after COT guidance are improved by providing a classification basis.
The expert instance/criteria used is predetermined.
Fig. 7 shows rules for exemplary device types, components, component types, sites, corresponding defect descriptions, and corresponding classifications by use of rules that classify corresponding defect descriptions into corresponding severity levels or degrees.
Those skilled in the art will appreciate that in the power industry, other different rules may be set for power defect descriptions found or detected by power devices based on industry knowledge.
Embodiment III:
The present invention also provides an electronic device, as shown in fig. 8, which includes a processor 801, a memory 802, a bus 803, and a computer program stored in the memory 802 and executable on the processor 801, where the processor 801 includes one or more processing cores, the memory 802 is connected to the processor 801 through the bus 803, and the memory 802 is used to store program instructions, where the processor implements the steps in the method embodiment of the first embodiment of the present invention when the processor executes the computer program.
Further, as an executable scheme, the electronic device may be a computer unit, and the computer unit may be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, and the like. The computer unit may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the constituent structures of the computer unit described above are merely examples of the computer unit and are not limiting, and may include more or fewer components than those described above, or may combine certain components, or different components. For example, the computer unit may further include an input/output device, a network access device, a bus, etc., which is not limited by the embodiment of the present invention.
Further, as an executable, the Processor may be a central processing unit (Central Processing Unit, CPU), other general purpose Processor, digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is a control center of the computer unit, connecting various parts of the entire computer unit using various interfaces and lines.
The memory may be used to store the computer program and/or modules, and the processor may implement the various functions of the computer unit by running or executing the computer program and/or modules stored in the memory, and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of the cellular phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card (SMART MEDIA CARD, SMC), secure Digital (SD) card, flash memory card (FLASH CARD), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
Embodiment four:
The present invention also provides a computer readable storage medium storing a computer program which when executed by a processor implements the steps of the above-described method of an embodiment of the present invention.
The modules/units integrated with the computer unit may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a software distribution medium, and so forth. It should be noted that the content of the computer readable medium can be appropriately increased or decreased according to the requirements of the legislation and the patent practice in the jurisdiction.
Fifth embodiment:
The invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method as described above.
While the invention has been particularly shown and described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for LLM to implement power defect description reasoning, comprising:
Receiving an input power defect description;
generating an intermediate reasoning step conforming to a predetermined logic relationship by using a CoT prompt designed in advance for the power defect description field;
the LLM identifies the defect severity degree to which the received power defect description belongs according to the intermediate reasoning step and the corresponding relation between the preset power defect description and the defect severity degree, and deduces the basis for making the identification and/or the reasoning path for making the identification;
the LLM outputs the identified severity of the defect and outputs a basis for making the identification and/or an inference path for making the identification.
2. The method as recited in claim 1, further comprising:
generating an intermediate reasoning step conforming to a predetermined logic relationship by using a CoT prompt designed in advance for the electric power defect description field and applying an automatic CoT algorithm; and/or the number of the groups of groups,
The LLM is evaluated using a pre-collected test dataset, the evaluation including evaluating identification accuracy and consistency of intermediate reasoning steps.
3. The method of claim 1, wherein the power defect description includes a question for a power defect, the method further comprising:
the method comprises the steps of predefining the problems to be solved in the field of power defect description, wherein the problems to be solved comprise: identifying a severity of the power defect and inferring a cause of the power defect;
pre-collecting structured, semi-structured, and/or unstructured data related to a power defect, the structured and/or unstructured data related to a power defect comprising: a description of the power device, the description of the power device including a description of the power defect, a problem classification criterion, and/or an example of an inference path;
Carrying out knowledge extraction on the collected data in advance, defining a body, and constructing a triplet (h, r, t) of a knowledge graph in the electric power defect description field, wherein h is a head entity, r is a relation between the head entity and the tail entity, and t is a tail entity; the body comprises at least defect content, defect properties and classification basis, wherein the defect properties describe the severity of the defect, and the classification basis describes the basis for identifying the defect content as corresponding defect severity;
The CoT prompt aiming at the electric power defect description field is designed in advance based on the constructed triples and the knowledge graph.
4. A method according to claim 3, further comprising the step of preprocessing the collected data prior to defining the ontology, the preprocessing comprising:
data cleansing, wherein the data cleansing comprises deduplication;
marking the data after data cleaning;
word segmentation is carried out on the data after the marking treatment;
And converting the data after word segmentation into structured data.
5. A method according to claim 3, wherein the relationship between the head-to-tail entities comprises:
Power or line type-power station or line, power station or line-voltage class, power station or line-defect phenomenon, defect attribute-defect phenomenon, defect location-device component, device component-defect phenomenon, defect location-defect description, defect description-defect phenomenon, device type-defect device, defect device-device component type, and/or device component type-device component.
6. The method of claim 1, wherein the step of generating intermediate inferences that meet a predetermined logical relationship using CoT hints pre-designed for the power defect description domain comprises:
Analyzing a description of the received power defect description for a problem and directing the LLM to generate one or more inference steps related to the problem description using a first hint phrase contained in the CoT hint, the first hint phrase for introducing a cause of occurrence of the problem;
Introducing an analysis of the severity of the problem using a second prompt phrase contained in the CoT prompt;
a solution and/or suggestion is introduced using a third hint phrase included in the CoT hint.
7. A method according to claim 3, comprising one or more of the following:
For the collected structured data, a rule-based rapid keyword extraction algorithm RAKE is adopted to conduct knowledge extraction;
For the collected semi-structured data, knowledge extraction is performed using a pre-built syntax tree;
for the collected unstructured data, knowledge extraction was performed using the BERT-BiLSTM-CRF model.
8. An electronic device comprising a memory and a processor, the memory storing at least one program, the at least one program being executable by the processor to implement the method of any one of claims 1 to 8.
9. A computer readable storage medium, characterized in that at least one program is stored in the storage medium, the at least one program being executed by a processor to implement the method of any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method according to any of claims 1 to 8.
CN202410166221.XA 2024-02-05 2024-02-05 Method, device, medium and program product for LLM to implement power defect description reasoning Pending CN118070901A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410166221.XA CN118070901A (en) 2024-02-05 2024-02-05 Method, device, medium and program product for LLM to implement power defect description reasoning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410166221.XA CN118070901A (en) 2024-02-05 2024-02-05 Method, device, medium and program product for LLM to implement power defect description reasoning

Publications (1)

Publication Number Publication Date
CN118070901A true CN118070901A (en) 2024-05-24

Family

ID=91098316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410166221.XA Pending CN118070901A (en) 2024-02-05 2024-02-05 Method, device, medium and program product for LLM to implement power defect description reasoning

Country Status (1)

Country Link
CN (1) CN118070901A (en)

Similar Documents

Publication Publication Date Title
Mitra et al. Sentiment analysis using machine learning approaches
Jing et al. Correlation analysis and text classification of chemical accident cases based on word embedding
CN112100397A (en) Electric power plan knowledge graph construction method and system based on bidirectional gating circulation unit
CN110188047A (en) A kind of repeated defects report detection method based on binary channels convolutional neural networks
Milea et al. Prediction of the msci euro index based on fuzzy grammar fragments extracted from european central bank statements
CN116028646A (en) Power grid dispatching field knowledge graph construction method based on machine learning
CN112036179B (en) Electric power plan information extraction method based on text classification and semantic frame
CN117370568A (en) Power grid main equipment knowledge graph completion method based on pre-training language model
Zhang et al. A textcnn based approach for multi-label text classification of power fault data
CN111160756A (en) Scenic spot assessment method and model based on secondary artificial intelligence algorithm
CN111737993A (en) Method for extracting health state of equipment from fault defect text of power distribution network equipment
CN116227584A (en) Pre-training language model building method, system and medium for power industry
CN116029295A (en) Electric power text entity extraction method, defect positioning method and fault diagnosis method
CN118070901A (en) Method, device, medium and program product for LLM to implement power defect description reasoning
Gräßler et al. Automated Requirement Dependency Analysis for Complex Technical Systems
Ni et al. Predicting severity of software vulnerability based on BERT-CNN
CN115293827A (en) Novel model interpretability analysis method for assisting fine operation of enterprise
Wang et al. Knowledge acquisition method from domain text based on theme logic model and artificial neural network
Kedia et al. Classification of safety observation reports from a construction site: An evaluation of text mining approaches
Lu et al. MIAR: A Context-Aware Approach for App Review Intention Mining
Noyori et al. Deep learning and gradient-based extraction of bug report features related to bug fixing time
Sun et al. Ensemble Machine Learning Identification of Power Fault Countermeasure Text Considering Word String TF-IDF Feature
Zhang et al. Design of Intelligent Auxiliary Input System for Distribution Equipment Defects Based on HMM and Word2vec
Yang et al. Exploring multi-layer convolutional neural networks for railway safety text classification
CN117633217A (en) Power text data processing method, device, equipment, medium and program product

Legal Events

Date Code Title Description
PB01 Publication