Composite entity relation extraction method suitable for power field
By constructing triple extraction instruction data sets in the power field and using low-rank adaptation and enhanced sequence annotation named entity recognition modules, the problem of poor triplex extraction in the power field is solved, and entities and relationships are realized The efficient and accurate extraction of the model improves the application performance of the power field.
Patent Information
- Application Number
- CN202411206427.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2025-01-07
AI Technical Summary
Large language models have poor triplex extraction in the power field, making it difficult to understand complex technical terms and expertise, resulting in insufficient depth and accuracy of entity relationship extraction.
By constructing a triple extraction instruction dataset in the power field, the low-rank adaptive PEFT method is used to fine-tune the large language model, and combined with enhanced sequence labeled named entity recognition and adaptive relationship mapping module, the model's information in the power field is improved Extraction and natural language comprehension skills.
In the triple extraction task in the power field, the accuracy and efficiency of entities and relationships increased by about 56% on average, and the maximum was 70.95%, significantly improving the application performance of the power field of large language models.
Smart Images

Figure CN119272771A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of large language models, and in particular to a composite entity relationship extraction method applicable to the electric power field. Background Art
[0002] In the field of artificial intelligence and natural language processing, large language models have become a revolutionary technology. By learning from massive text data, they can understand and generate human language and provide support for various applications. At the same time, large language models have also demonstrated excellent performance in multiple tasks such as language understanding, text generation, and information extraction. The GPT-RE method proposed by Wan et al. effectively improves the extraction of general domain relation triples through contextual learning. The comprehensive information extraction framework InstructUIE based on instruction fine-tuning developed by Wang et al. also pioneered the extraction of general information with large language models.
[0003] For example, in the Chinese patent literature, the publication number is CN118093820A, the publication date is May 28, 2024, and the name is a method and system for intelligent generation of knowledge query statements driven by large-model and few-sample context learning based on scene perception. By utilizing the context learning ability of a large language model, efficient knowledge query statement generation is achieved based on a small number of examples.
[0004] Although the above existing technologies have a broad knowledge base and strong learning ability, they still face the challenge of insufficient understanding depth and accuracy in highly professional technical fields such as the power sector. The power sector involves complex technical terms, professional knowledge and strict operating procedures. It is difficult for general models to accurately grasp these professional contents and it is difficult to show good results in power triple extraction. Summary of the invention
[0005] In order to solve the shortcomings of the above-mentioned prior art, the present invention provides a composite entity relationship extraction method suitable for the power field, which improves the triple extraction effect of the large language model in the power field. In the triple extraction task in the power field, the accuracy and efficiency of extracting entities and relationships are improved by an average of about 56%, and the highest is increased from 10.57% to 70.95%.
[0006] The present invention is achieved through the following technical solutions:
[0007] A composite entity relationship extraction method applicable to the electric power field, characterized in that it comprises the following steps:
[0008] S1. Clean and transform the data from the entity relationship annotation dataset NPICKG in the power industry to obtain the NPICKG instruction dataset suitable for fine-tuning the large language model;
[0009] S2. Based on the NPICKG instruction dataset in step S1, the large language model is fine-tuned through the low-rank adaptive PEFT method to enhance the information extraction and natural language understanding capabilities of the large language model in the power field;
[0010] S3. The fine-tuned large language model adopts an entity and relation extraction enhancement method based on contextual learning. By enhancing the sequence-labeled named entity recognition module, the user's question is used as the input text to perform the named entity recognition task in the form of sequence labeling. Then, using the named entities in the form of sequence labeling, the adaptive relation mapping module performs the relation triple extraction task in the form of multiple-choice questions, and obtains a set of candidate triples consisting of entities, entity types, and relations.
[0011] Furthermore, the specific steps of the S1 step are: for each data in the NPICKG data set, a series of instruction data is constructed through code conversion, and each instruction data in the series of instruction data is divided into an instruction part and an output part, wherein the instruction part includes three fields: task description, mode and input.
[0012] Furthermore, the pattern field in the instruction part specifies in detail the type of SPO triples to be extracted. Each SPO triple consists of three parts: the head entity type, the relationship, and the tail entity type;
[0013] The task description field in the instruction part provides specific instructions to clearly guide the large language model to complete the task, that is, to instruct the large language model to extract SPO triples that match the predefined pattern from the given input text; for types not defined in the pattern, the large language model should return an empty list and ensure that its answer conforms to the format requirements of the JSON string;
[0014] The input field in the instruction part is the input text received by the large language model. The large language model needs to analyze and process the input text according to the above task description and mode;
[0015] The output part is the output generated by the large language model after processing the given input text, and includes specific SPO triple information extracted from the text given in the input field.
[0016] Furthermore, each JSON string in the pattern contains at most 5 types of SPO triples.
[0017] Furthermore, the specific steps of fine-tuning in step S2 are:
[0018] S2.1. Decompose the original weight matrix W of the large language model into two low-rank matrices A and B, that is, W = AB, where the ranks of the low-rank matrix A and the low-rank matrix B are much smaller than the rank of the original weight matrix W;
[0019] S2.2. During the fine-tuning process, only the parameters of the low-rank matrix A and the low-rank matrix B are trained. The original weight matrix W is replaced by the product of AB, and the original weight matrix is kept unchanged to achieve fine-tuning of the large language model.
[0020] Furthermore, in the step S3, the enhanced sequence annotation entity recognition module performs the named entity recognition task in the form of sequence annotation. Specifically, the prompt prompt(*) is first constructed. When faced with any specified input text I, a prompt instruction specially designed for I is formed, marked as Prompt(I); then, this prompt instruction is submitted as input to the large language model to generate a series of text sequences V = {v1,…,v n}; Finally, map this text sequence V into a series of entity recognition labels to obtain the final output O.
[0021] Furthermore, the design of the Prompt (I) can be further decomposed into three components:
[0022] The first part of the task is a fixed sentence, which sets the role for the large language model and indicates the task; the second part of the task is a variable sentence, which is to mark all entities with entity type [entity type] in the input text I to indicate the entity type to be extracted by the large language model. [Entity type] is a variable parameter, which represents the specific entity type to be extracted by the task; the third part of the task is a fixed sentence, that is, please use double brackets to mark the recognized entities on the input text I, and output the original input text I if it is not recognized;
[0023] Example, an example is a variable paragraph, consisting of a positive text pair and a negative text pair. By adding a small number of examples to conduct contextual learning of the large language model, the expected output format of the large language model is effectively guided;
[0024] Input,The input is a variable paragraph, which represents the text that needs to be recognized by named entities, that is, the input text I.
[0025] Furthermore, for each entity type, a text entry containing the entity type is selected from the NPICKG dataset as input, and its output is adjusted according to the format of double-bracket entity annotation. Such input and output pairs are used as positive text pairs; for each entity type, text that does not contain the entity type is selected from the NPICKG dataset as input, and the same text is copied as output. Such input and output pairs form negative text pairs.
[0026] Furthermore, in the S3 step, the adaptive relationship mapping module converts the relationship into a logically fluent natural language representation by designing a relationship mapping template, combines the relationship converted by the relationship mapping template with the final output O to construct a set of multiple-choice questions, and submits the generated multiple-choice questions to the large language model for processing, and maps the correct options selected by the large language model back to specific triples to obtain a set of candidate triples consisting of entities, entity types, and relationships, thereby completing the triple selection task.
[0027] The beneficial effects of the present invention are as follows:
[0028] By constructing a data set of triple extraction instructions in the power field, LoRA fine-tuned the base large language model and improved its triple extraction capabilities in the power field, and on this basis, added an entity and relationship extraction enhancement method based on context learning to further improve the triple extraction effect of the large language model in the power field. The results show that the large language model enhanced by the practical invention has an average increase of about 56% in the accuracy and efficiency of extracting entities and relationships in the power field triple extraction task, and the highest has increased from 10.57% to 70.95%. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of a process of extracting composite entity relationships applicable to the electric power field according to the present invention;
[0030] Figure 2 This is an example of the output format of the large language model under the ESLER module in a composite entity relationship extraction method applicable to the electric power field of the present invention;
[0031] Figure 3 This is an example of an ESLER prompt template in a composite entity relationship extraction method applicable to the electric power field of the present invention;
[0032] Figure 4 It is an ARM relationship mapping template in a composite entity relationship extraction method applicable to the electric power field of the present invention;
[0033] Figure 5 This is an example of an ARM prompt template in a composite entity relationship extraction method applicable to the electric power field of the present invention. DETAILED DESCRIPTION
[0034] Example 1
[0035] like Figure 1 As shown, a composite entity relationship extraction method applicable to the power field includes the following steps:
[0036] S1. Clean and transform the data from the entity relationship annotation dataset NPICKG in the power industry to obtain the NPICKG instruction dataset suitable for fine-tuning the large language model;
[0037] S2. Based on the NPICKG instruction dataset in step S1, the large language model is fine-tuned through the low-rank adaptive PEFT method to enhance the information extraction and natural language understanding capabilities of the large language model in the power field;
[0038] S3. The fine-tuned large language model adopts an entity and relation extraction enhancement method based on contextual learning. By enhancing the sequence-labeled named entity recognition module, the user's question is used as the input text to perform the named entity recognition task in the form of sequence labeling. Then, using the named entities in the form of sequence labeling, the adaptive relation mapping module performs the relation triple extraction task in the form of multiple-choice questions, and obtains a set of candidate triples consisting of entities, entity types, and relations.
[0039] In this embodiment, the NPICKG instruction dataset is derived from the entity relationship annotation dataset NPICKG within the power industry. The dataset is based on a wide range of documents related to the power field, including design instructions, equipment specifications, operating manuals, and maintenance records, etc. These documents provide rich domain knowledge and detailed technical information. Through systematic collection, preprocessing, and fine annotation, the NPICKG dataset not only contains a large number of entities and relationships, but also reflects the complex interactions and operating procedures between power equipment components, providing a foundation for the large language model to deeply understand and learn knowledge in the power field. By following a strict data processing process and combining the in-depth insights of experts in the power field, the NPICKG dataset is cleaned and transformed to obtain the NPICKG instruction dataset for fine-tuning.
[0040] The PEFT method based on low-rank adaptation (LoRA) is used to fine-tune the large language model to enhance the information extraction and natural language understanding capabilities of the large language model in the power field. The core idea of LoRA technology is to adjust and optimize the self-attention mechanism of the large language model by introducing a low-rank matrix. Compared with complete retraining or large-scale parameter adjustment, this method can fine-tune the large language model more efficiently and accurately. By using the LoRA fine-tuning strategy, we can achieve effective customization of the large language model without significantly increasing the complexity of the large language model, so that it can better adapt to data and tasks in specific fields.
[0041] This example is mainly implemented using the open source machine learning library PyTorch developed by Facebook's artificial intelligence research team. The experimental server uses the Red Hat Enterprise Linux 8 operating system and the GPU uses a single-card NVIDIA-A100-80G GPU. CUDA 11.7 is used to accelerate deep learning operations, and Python 3.10 is selected as the programming language to ensure efficient execution of the experiment and full display of the performance of the large language model.
[0042] Example 2
[0043] This embodiment further elaborates and supplements the implementation mode of the present invention on the basis of Embodiment 1.
[0044] The specific steps of the S1 step are: for each data of the NPICKG dataset, a series of instruction data is converted and constructed through code, as shown in Table 1. Each instruction data in the series of instruction data is divided into an instruction part and an output part, wherein the instruction part includes three fields: task description, mode and input.
[0045] Table 1. Data example of NPICKG instruction data set
[0046]
[0047] The pattern field in the instruction part specifies the type of SPO triples to be extracted. Each SPO triple consists of a head entity type (subject_type), a relation (relation), and a tail entity type (subject_type). For example, the pattern may define three types of SPO triples: (power equipment, component, power component), (power station, located, geographical location), (power station, expert, person).
[0048] The task description field in the instruction part provides specific instructions to clearly guide the large language model to complete the task. For example, the instruction may require the large language model to act as an expert focusing on the extraction of SPO triples of power equipment, instructing the large language model to extract SPO triples that match the predefined pattern from the given input text; for types not defined in the pattern, the large language model should return an empty list and ensure that its answer conforms to the format requirements of the JSON string;
[0049] The input field in the instruction part is the input text received by the large language model. The large language model needs to analyze and process the input text according to the above task description and pattern; for example, the input text is "steam generator is an important component of the power station, which is composed of tube sheets and other parts." The large language model needs to extract SPO triples that meet the above pattern definition based on this text.
[0050] The output part is the output generated by the large language model after processing the given input text, and includes specific SPO triple information extracted from the text given in the input field.
[0051] Given that a large language model’s performance will be affected by a long context length, each JSON string in the pattern field contains at most 5 types of SPO triples. Considering that the NPICKG dataset predefines 20 types of SPO triples, this means that each piece of data in the NPICKG dataset will generate 4 instruction training data. This meticulous design not only takes into account practical technical limitations, but also ensures the efficiency of the training process and the accuracy of the target.
[0052] Example 2
[0053] This embodiment further elaborates and supplements the implementation method of the invention on the basis of Embodiment 1.
[0054] The specific steps of fine-tuning in step S2 are:
[0055] S2.1. Decompose the original weight matrix W of the large language model into two low-rank matrices A and B, that is, W = AB, where the ranks of the low-rank matrix A and the low-rank matrix B are much smaller than the rank of the original weight matrix W;
[0056] S2.2. During the fine-tuning process, only the parameters of the low-rank matrix A and the low-rank matrix B are trained. The original weight matrix W is replaced by the product of AB to keep the original weight matrix unchanged, thereby achieving fine-tuning of the large language model.
[0057] Example 3
[0058] This embodiment further elaborates and supplements the implementation mode of the present invention on the basis of Embodiment 1 or Embodiment 2.
[0059] The Enhanced Sequence Labeling Entity Recognition module (ESLER) performs the named entity recognition task in the form of sequence labeling. The specific steps are as follows: first, a prompt prompt(*) is constructed. When faced with any specified input text I, a prompt instruction specially designed for I is formed, marked as Prompt(I); then, this prompt instruction is submitted as input to the large language model to generate a series of text sequences V = {v1,…,v n}; Finally, the text sequence V is mapped into a series of entity recognition tags to obtain the final output O. Specifically, by matching the entity type in the "task" and the entity content in the double brackets, zero, one or more entity pairs are obtained to obtain the final output O.
[0060] The way to annotate the text sequence V is crucial. The annotation method must clearly separate the boundaries of entities and make the entities easy to extract. At the same time, the annotated text sequence V should be easy to generate by a large language model, thereby improving the accuracy of the named entity recognition task. To meet this requirement, a new large language model output format is introduced. Figure 2 As shown in the figure, for an input sequence containing at least one entity, the identified entity should be surrounded by specific tags "((" and "))"; if the input sequence does not involve any relevant entities, the output V will be the same as the input I. This strategy converts the generation task of the large language model into a sequence labeling task. The large language model only needs to mark the entity position and copy the rest, which greatly reduces the complexity of fully encoding the label information in the generated text.
[0061] Further, such as Figure 3 As shown, the design of Prompt (I) can be further decomposed into three components:
[0062] Task, the first part of the task is a fixed sentence, namely "You are an expert in named entity recognition of power stations", which is designed to set the role of the large language model and indicate the task; the second part of the task is a variable sentence, "The task is to mark all entities with entity type [entity type] in the given input text I", to indicate the entity type to be extracted by the large language model, [entity type] is a variable parameter, representing the specific entity type to be extracted by the task, for example, when the task is to extract entities with entity type "power station components", [entity type] is replaced with "power station components". Because the length of the large language model prompt is strictly limited, it is impossible to include the description of all entity types in a single prompt. At the same time, including too many entity type prompts in a single prompt will also affect the design of special symbols to distinguish multiple types of entities. Therefore, for each input, we need to construct N prompts, each corresponding to an entity type. In other words, we need to traverse all entity type labels to ensure that no entity type to be selected is missed; the third part of the task description is a fixed sentence, namely "Please use double brackets to mark the recognized entities on the original text. If no entity is recognized, output the original text", which can ensure that the large language model outputs the answer according to our annotation method.
[0063] Example, an example is a variable paragraph, consisting of a positive text pair and a negative text pair. By adding a small number of examples to conduct contextual learning of the large language model, the expected output format of the large language model can be effectively guided. According to the idea of contrastive learning, when the entity type is "power station component", we give an extraction example of a text containing a power station component as a positive example, and at the same time give an extraction example of a text that does not contain a power station component as a negative example. That is, "{Input: The cooling system is one of the key components for the safe operation of the power station, which includes parts such as cooling pumps. Output: ((Cooling system)) is one of the key components for the safe operation of the power station, which includes parts such as cooling pumps.}{Input: Daya Bay Power Station is located on the Dapeng Peninsula. Output: Daya Bay Power Station is located on the Dapeng Peninsula.}". This small number of examples method can effectively guide the expected output format of the large language model.
[0064] In order to optimize the example selection strategy so that a small number of examples can more accurately reflect the specific entity types in the task, this study constructed an example template library for named entity recognition, as shown in Table 2. For each entity type, a text entry containing the entity type is selected from the NPICKG dataset as input, and its output is adjusted according to the format of double-bracket entity annotation. Such input and output pairs are used as positive examples; for each entity type, text that does not contain the entity type is selected from the NPICKG dataset as input, and the same text is copied as output. Such input and output pairs form negative examples.
[0065] Input,The input part is a variable paragraph, which represents the text that needs to be recognized by named entities.
[0066] Table 2. ESLER example template library
[0067]
[0068] Adaptive Relationship Mapping (ARM), such as Figure 4 As shown in the figure, by designing a relation mapping template, the relation type is transformed into a logically fluent natural language representation, for example, "place of occurrence" is converted into "{entity i} occurs in {entity j} region". When more than two entities are identified in the text, the large language model will traverse all possible entity pair combinations and list all potential options. When the number of relation types is m and the number of entities is n (n>2), the number of options generated for each text is at least m×n!, which may reduce the accuracy of the large language model in answering questions. To solve this problem, a pattern constraint method for refining relation types is introduced. By retrieving the schema type in the NPICKG dataset, the number of candidate relation types is reduced. For example, when the entity types are "nuclear incident" and "text", we retrieved the schema including "nuclear incident_cause_text", "nuclear incident_result_text" and "nuclear incident_treatment measures_text", thereby establishing "cause", "result" and "treatment measures" as candidate relations, and then only converting these three relations in the relation mapping template, thereby reducing the number of irrelevant options generated.
[0069] The final output O of the relationship and entity recognition label after the relationship mapping template conversion is used to construct a set of multiple-choice questions. This method not only simplifies the complexity of the relationship extraction task, but also makes full use of the advantages of the large language model in processing question-answering tasks, and improves the accuracy and efficiency of relationship recognition. Figure 5 As shown, the generated multiple-choice question construction prompt template is handed over to the large language model for processing, and the correct options selected by the large language model are mapped back to specific triples to obtain a set of candidate triples consisting of entities, entity types, and relations, thus completing the triple selection task.
[0070] In order to compare and evaluate the entity relationship extraction capabilities of large language models, the confusion matrix is used to follow the standard evaluation indicators to evaluate the entity relationship extraction performance of large language models through precision, recall and F1 score.
[0071] 1. Fine-tuning experiment
[0072] In this paper, the large language model power field triple extraction task is defined as an autoregressive generation task, which is guided by clear instructions. This task first requires the large language model to interpret the instructions and identify the intention behind them. Then, the large language model extracts specific triple information related to the power field from the given text based on the information contained in the instructions.
[0073] Table 3. Triple extraction results of the open source large language model before and after Lora fine-tuning
[0074]
[0075]
[0076] The results of fine-tuning the large language model are shown in Table 3. The results show that the LoRA fine-tuning strategy greatly improves the adaptability and effectiveness of the large language model for complex information extraction tasks in the power field. After fine-tuning the LoRA based on the power instruction dataset, the major language models all showed significant performance improvements. Specifically, the F1 value indicators of all large language models have improved. For example, after fine-tuning, the F1 value of the ChatGLM-6B model increased from 4.12 to 48.09, and the F1 value of the Baichuan-13B model jumped from 12.06 to 65.79. At the same time, the F1 value of the Qwen-14B model increased by 6 times after fine-tuning.
[0077] 2. Ablation experiment of entity and relation extraction enhancement method based on context learning
[0078] The entity and relation extraction enhancement method based on contextual learning can be applied to the large language model before fine-tuning and the large language model after fine-tuning, so we conducted ablation experiments on the large language model before and after fine-tuning. This experimental strategy can test the relative independence of the context method and the fine-tuning method, while allowing us to accurately evaluate the impact of each module on the performance of the large language model and the synergistic effect when they are used together. Specifically, we still use ChatGLM-6B, Baichuan-7B, Baichuan-13B, and Qwen-14B as the baseline large language model before fine-tuning. For these models, we tested three different settings: adding only the ESLER module and using the normal mode for relation extraction, and adding the ESLER module and the ARM module at the same time. In this way, we can analyze the contribution of each component separately, as well as their impact on the performance of the large language model when combined.
[0079] Table 4. Ablation experiments of ESLER and ARM large language models before fine-tuning
[0080]
[0081] The ablation experiment of the large language model before fine-tuning is shown in Table 4. By introducing ESLER and ARM to these large language models to fuse contextual information, their F1 values have been improved to a certain extent, showing the enhancement of the large language model's ability to understand tasks and extract triple information. However, due to the lack of electricity knowledge and other reasons, the large language model without fine-tuning has poor performance in triple extraction tasks, with a maximum F1 value of only about 16%, and cannot be directly applied to actual extraction work. However, even after the enhancement of these modules, the performance of the large language model in complex triple information extraction tasks is still limited. This shows that on billion- and 10-billion-level large language models, methods that rely solely on contextual learning have limitations and cannot effectively solve the triple extraction problem in large language models in the power field.
[0082] Table 5. Ablation experiments of ESLER and ARM large language models after fine-tuning
[0083]
[0084] The ablation experiment of the fine-tuned large language model is shown in Table 5. The knowledge extraction ability of the large language model is significantly improved after fine-tuning. When the ESLER and ARM modules are added to the model, although the exact value of the gain varies with the large language model and the module, the trend is consistent. We see that the F1 score has improved, which shows that these modules are effective in improving the performance of information extraction tasks. After the large language model fine-tuned by LoRA in the power field was enhanced by the ESLER+ARM module, the best two large language models with tens of billions of parameters obtained an F1 value greater than 70%, which is 7% higher than the large language model after fine-tuning, and about 60 points higher than the base large language model before fine-tuning.
Claims
1. A composite entity relationship extraction method applicable to the electric power field, characterized by: The steps include: S1. Clean and transform the data from the entity relationship annotation dataset NPICKG in the power industry to obtain the NPICKG instruction dataset suitable for fine-tuning the large language model; S2. Based on the NPICKG instruction dataset in step S1, the large language model is fine-tuned through the low-rank adaptive PEFT method to enhance the information extraction and natural language understanding capabilities of the large language model in the power field; S3. The fine-tuned large language model adopts an entity and relation extraction enhancement method based on contextual learning. By enhancing the sequence-labeled named entity recognition module, the user's question is used as the input text to perform the named entity recognition task in the form of sequence labeling. Then, using the named entities in the form of sequence labeling, the adaptive relation mapping module performs the relation triple extraction task in the form of multiple-choice questions, and obtains a set of candidate triples consisting of entities, entity types, and relations.
2. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 1, characterized in that: The specific steps of step S1 are: for each data of the NPICKG data set, a series of instruction data is constructed through code conversion, and each instruction data in the series of instruction data is divided into an instruction part and an output part, wherein the instruction part includes three fields: task description, mode and input.
3. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 2, characterized in that: The pattern field in the instruction part specifies in detail the type of SPO triples to be extracted. Each SPO triple consists of three parts: the head entity type, the relationship, and the tail entity type. The task description field in the instruction part provides specific instructions to clearly guide the large language model to complete the task, that is, to instruct the large language model to extract SPO triples that match the predefined pattern from the given input text; for types not defined in the pattern, the large language model should return an empty list and ensure that its answer conforms to the format requirements of the JSON string; The input field in the instruction part is the input text received by the large language model. The large language model needs to analyze and process the input text according to the above task description and mode; The output part is the output generated by the large language model after processing the given input text, and includes specific SPO triple information extracted from the text given in the input field.
4. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 3, characterized in that: Each JSON string in the pattern contains at most five types of SPO triples.
5. The composite entity relationship extraction method applicable to the electric power field as claimed in claim 1, characterized in that: The specific steps of fine-tuning in step S2 are: S2.
1. Decompose the original weight matrix W of the large language model into two low-rank matrices A and B, that is, W=AB, where the ranks of the low-rank matrices A and B are much smaller than the rank of the original weight matrix W; S2.
2. During the fine-tuning process, only the parameters of the low-rank matrix A and the low-rank matrix B are trained. The original weight matrix W is replaced by the product of AB, and the original weight matrix is kept unchanged to achieve fine-tuning of the large language model.
6. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 1, characterized in that: In the step S3, the enhanced sequence annotation entity recognition module performs the named entity recognition task in the form of sequence annotation. The specific steps are as follows: first, a prompt prompt(*) is constructed. When faced with any specified input text I, a prompt instruction specially designed for I is formed, marked as Prompt(I); then, this prompt instruction is submitted as input to the large language model to generate a series of text sequences V={v1,…,v n }; Finally, map this text sequence V into a series of entity recognition labels to obtain the final output O.
7. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 6, characterized in that: The design of Prompt (I) can be further decomposed into three components: The first part of the task is a fixed sentence, which sets the role for the large language model and indicates the task; the second part of the task is a variable sentence, which is to mark all entities with entity type [entity type] in the input text I to indicate the entity type to be extracted by the large language model. [Entity type] is a variable parameter, which represents the specific entity type to be extracted by the task; the third part of the task is a fixed sentence, that is, please use double brackets to mark the recognized entities on the input text I, and output the original input text I if it is not recognized; Example, an example is a variable paragraph, consisting of a positive text pair and a negative text pair. By adding a small number of examples to conduct contextual learning of the large language model, the expected output format of the large language model is effectively guided; Input,The input is a variable paragraph, which represents the text that needs to be recognized by named entities, that is, the input text I.
8. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 7, characterized in that: For each entity type, a text entry containing the entity type is selected from the NPICKG dataset as input, and its output is adjusted according to the format of double-bracket entity annotation. Such input and output pairs are regarded as positive text pairs; for each entity type, text that does not contain the entity type is selected from the NPICKG dataset as input, and the same text is copied as output. Such input and output pairs form negative text pairs.
9. A composite entity relationship extraction method applicable to the electric power field as claimed in claim 6, characterized in that: In the step S3, the adaptive relationship mapping module converts the relationship into a logically fluent natural language representation by designing a relationship mapping template, combines the relationship converted by the relationship mapping template with the final output O to construct a set of multiple-choice questions, and submits the generated multiple-choice questions to the large language model for processing, maps the correct options selected by the large language model back to specific triples, and obtains a set of candidate triples consisting of entities, entity types, and relationships, thereby completing the triple selection task.
Citation Information
Patent Citations
Method and system for intelligently generating knowledge query statements driven by large-model and few-sample context learning based on scene awareness
CN118093820A
Cited By
Bidding file generation method and device, equipment and storage medium
CN120068838A