A power data information extraction method and device based on a large language model

CN117828099BActive Publication Date: 2026-09-22CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311868562.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-29
Publication Date
2026-09-22
Estimated Expiration
2043-12-29

AI Technical Summary

Technical Problem

[0003]为了能解决了传统信息抽取对数据的依赖、上下文信息利用不充分,以及传统信息抽取需要大量标注数据的问题,本申请提供了一种基于大型语言模型的电力数据信息抽取方法和装置

Benefits of technology

[0020]本申请提供的一种基于大型语言模型的电力数据信息抽取方法,包括获取目标句子;根据所述目标句子、预设的电力信息抽取提示模板和选定的语言模型,得到所述目标句子所属预设电力信息类型;获取用户设定的任务类型,根据所述目标句子、所述任务类型和所述语言模型,得到所述目标句子中的信息抽取结果,通过实体链接方法查找电力知识库中是否存在待验证实体;若是,则将待验证实体加入候选集集合;否则,通过结果验证提示模板和语言模型确认待验证实体是否是一个实体,若是,则将待验证实体则加入候选集集合,否则丢掉待验证实体;将候选集中未存入电力知识库的待验证实体更新至电力知识库并以Json格式输出所述目标句子的信息抽取结果。本申请解决了传统信息抽取对数据的依赖、上下文信息利用不充分等问题;提高大型语言模型的抽取能力,同时可以将未存在知识库的实体保存到知识库中,也解决了传统信息抽取需要大量标注数据的问题,同时提高信息抽取的泛化性能和实用性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117828099B_ABST
    Figure CN117828099B_ABST
Patent Text Reader

Abstract

The application relates to a power data information extraction method and device based on a large language model, which comprises the following steps: obtaining an information extraction result according to a target sentence, a preset power information extraction prompt template and a selected language model; obtaining a verification result of whether a to-be-verified entity in the information extraction result is an entity through result verification of the prompt template and the language model; adding the to-be-verified entity into a candidate set and updating the to-be-verified entity to a power knowledge base; and outputting the information extraction result of the target sentence in a Json format. The application solves the problems of traditional information extraction, such as dependence on data, insufficient utilization of context information and the like; improves the extraction capability of the large language model, saves entities not existing in the knowledge base into the knowledge base, solves the problem that a large amount of labeled data is required in traditional information extraction, and improves the generalization performance and practicability of information extraction. The application also relates to a computer device and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power system technology, and in particular to a method and apparatus for extracting power data information based on a large language model. Background Technology

[0002] Traditional information extraction tasks require manual annotation of large training datasets, which is time-consuming and labor-intensive, and suffers from problems such as disordered entities and relationships, incomplete extraction, and insufficient utilization of contextual information. These problems reveal the limitations of rule-based or tool-based NLP tasks, and inaccuracies in part-of-speech tagging and syntactic analysis can affect information extraction. Summary of the Invention

[0003] In order to solve the problems of traditional information extraction's dependence on data, insufficient utilization of contextual information, and the need for a large amount of labeled data, this application provides a method and apparatus for extracting power data information based on a large language model.

[0004] Firstly, this application provides a method for extracting power data information based on a large-scale language model, the method comprising:

[0005] Obtain the target sentence;

[0006] Based on the target sentence, the preset power information extraction prompt template, and the selected language model, the preset power information type to which the target sentence belongs is obtained;

[0007] Obtain the user-defined task type, and based on the target sentence, the task type, and the language model, obtain the information extraction result from the target sentence, which includes the entity to be verified.

[0008] The entity to be verified is checked in the power knowledge base using the entity linking method. If it exists, the entity to be verified is added to the candidate set. Otherwise, the entity to be verified is confirmed as an entity by the result verification prompt template and the language model.

[0009] If it is an entity, then the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded, and the entities to be verified in the candidate set that are not stored in the power knowledge base are updated to the power knowledge base.

[0010] Output the information extraction results of the target sentence in JSON format.

[0011] Secondly, this application also provides a power data information extraction device based on a large-scale language model, the device comprising:

[0012] The acquisition module is used to obtain the target sentence;

[0013] The first extraction module is used to obtain the preset power information type to which the target sentence belongs based on the target sentence, the preset power information extraction prompt template and the selected language model;

[0014] The second extraction module is used to obtain the task type set by the user, and to obtain the information extraction result in the target sentence based on the target sentence, the task type and the language model. The information extraction result includes the entity to be verified.

[0015] The verification module is used to search for the existence of the entity to be verified in the power knowledge base through the entity linking method. If it exists, the entity to be verified is added to the candidate set; otherwise, the update module is executed.

[0016] The update module is used to confirm whether the entity to be verified is an entity through the result verification prompt template and the language model. If it is, the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded, and the entities to be verified in the candidate set that are not stored in the power knowledge base are updated to the power knowledge base.

[0017] The results output module outputs the information extraction results of the target sentence in JSON format.

[0018] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the power data information extraction method based on a large language model as described in the first aspect.

[0019] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the power data information extraction method based on a large language model as described in the first aspect.

[0020] This application provides a method for extracting power data information based on a large language model, comprising: acquiring a target sentence; determining a preset power information type to which the target sentence belongs based on the target sentence, a preset power information extraction prompt template, and a selected language model; acquiring a user-defined task type; obtaining the information extraction result in the target sentence based on the target sentence, the task type, and the language model; searching for the existence of an entity to be verified in the power knowledge base using an entity linking method; if so, adding the entity to be verified to a candidate set; otherwise, confirming whether the entity to be verified is an entity using the result verification prompt template and the language model; if so, adding the entity to be verified to the candidate set; otherwise, discarding the entity to be verified; and updating the power knowledge base with entities to be verified that are not stored in the candidate set., The information extraction results of the target sentence are output in JSON format. This application solves the problems of data dependence and insufficient utilization of contextual information in traditional information extraction; it improves the extraction capability of large language models, and can save entities that do not exist in the knowledge base into the knowledge base. It also solves the problem that traditional information extraction requires a large amount of labeled data, and improves the generalization performance and practicality of information extraction. Attached Figure Description

[0021] The accompanying drawings, which form part of this specification, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:

[0022] Figure 1 This is a flowchart illustrating the power data information extraction method based on a large language model provided in an embodiment of this application.

[0023] Figure 2 This is a flowchart illustrating a power data information extraction method based on a large language model, provided in another embodiment of this application.

[0024] Figure 3 This is a schematic diagram of a power data information extraction device based on a large language model provided in another embodiment of this application. Detailed Implementation

[0025] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0026] The following detailed description is exemplary and intended to provide further detailed explanation of the invention. Unless otherwise specified, all technical terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this invention is for describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention.

[0027] Example 1:

[0028] The following will be combined with the appendix Figure 1 The method for extracting power data information based on a large language model provided in this application includes the following steps:

[0029] 110. Obtain the target sentence.

[0030] 120. Based on the target sentence, the preset power information extraction prompt template, and the selected language model, obtain the preset power information type to which the target sentence belongs.

[0031] Specifically, a power information extraction prompt template needs to be set in advance. This template is then input into the large model to obtain the target sentence type. For example, a pre-set power information extraction prompt template might be: "Based on the given sentence {}, please determine whether the sentence belongs to the {} power information type, where power information types include {equipment, fault, operation and maintenance, dispatch}". Of course, other forms of power information extraction prompt templates may also exist, which will not be elaborated here.

[0032] In addition, language models such as GPT and LLaMA can be selected in this embodiment.

[0033] 130. Obtain the user-defined task type, and based on the target sentence, task type, and language model, obtain the information extraction results from the target sentence, which include the entity to be verified.

[0034] Specifically, task types can be extracted through user settings, including relation extraction tasks, named entity recognition tasks, and event extraction tasks.

[0035] 140. Use the entity linking method to check if the entity to be verified exists in the power knowledge base;

[0036] If it exists, add the entity to be verified to the candidate set and proceed to step 150;

[0037] Otherwise, proceed to step 150;

[0038] 150. Confirm whether the entity to be verified is an entity by using the result verification prompt template and language model.

[0039] If so, the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded.

[0040] Update the entities to be verified that are not stored in the power knowledge base in the candidate set to the power knowledge base.

[0041] Specifically, the similarity between each entity in the power knowledge base and the entity in the target sentence is compared using a similarity matching algorithm. Text similarity matching algorithms include Jaccard similarity, Levenshtein edit distance, Simhash, TF-IDF, BM25, etc., all of which can be applied in this application.

[0042] 160. Output the information extraction results of the target sentence in JSON format.

[0043] Based on the above embodiments, step 120 further includes:

[0044] The target sentence is embedded into a preset power information extraction prompt template to obtain the first input information;

[0045] Input the first input information into the selected language model to obtain the preset power information type to which the target sentence belongs.

[0046] Based on the above embodiments, step 130 further includes:

[0047] Get the task prompt template for the task type;

[0048] The target sentence and its corresponding preset power information type are embedded into the task prompt template to obtain the second input information. This second input information is then input into the language model to obtain the information extraction results from the target sentence.

[0049] Based on the above embodiments, the task types further include relation extraction tasks, named entity recognition tasks, and event extraction tasks;

[0050] When the task type is a relation extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the relation extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity triple information. The entity to be verified includes the head entity, entity relation, and tail entity in the entity triple.

[0051] When the task type is named entity recognition task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the named entity recognition task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information. The entity to be verified includes the entity and entity type in the entity tuple.

[0052] When the task type is an event extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the event extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information, and the entities to be verified include the event information entities in the entity tuple information.

[0053] Based on the above embodiments, further, step 140, which involves searching the power knowledge base for the entity to be verified using the entity linking method, specifically includes:

[0054] The entity to be verified and the entities in the power knowledge base are input into a similarity matching algorithm to obtain a similarity score between each entity in the power knowledge base and the entity to be verified.

[0055] Determine whether there are entities in the power knowledge base with a similarity score greater than a preset score threshold;

[0056] If so, and the entity to be verified exists in the power knowledge base, then the entity to be verified is added to the candidate set.

[0057] Otherwise, if the entity to be verified does not exist in the power knowledge base, the verification prompt template and the language model are used to confirm whether the entity to be verified is an entity.

[0058] Based on the above embodiments, further, step 150 confirms whether the entity to be verified is an entity through the result verification prompt template and language model, specifically including:

[0059] Obtain the result verification prompt template, embed the entity to be verified into the result verification prompt template to obtain the third input information, input the third input information into the language model, and obtain the judgment result of whether the entity to be verified is an entity.

[0060] This application provides a method for extracting power data information based on a large language model, which solves the problems of data dependence and insufficient utilization of contextual information in traditional information extraction. It improves the extraction capability of the large language model and can save entities that do not exist in the knowledge base into the knowledge base. It also solves the problem that traditional information extraction requires a large amount of labeled data, and improves the generalization performance and practicality of information extraction.

[0061] Example 2:

[0062] The following will be combined with the appendix Figure 2 This paper provides a detailed description of the application of the power data information extraction method based on a large language model provided in this application in a real-world environment, specifically including the following steps:

[0063] S1. Obtain the target sentence.

[0064] S2. Embed the target sentence into the preset power information extraction prompt template to obtain the first input information;

[0065] S3. Input the first input information into the selected language model to obtain the preset power information type to which the target sentence belongs.

[0066] Specifically, for a given target sentence, design an information extraction prompt template, input the prompt template into a large language model, and obtain the target sentence type Sentence_type; the design of the information prompt template specifically refers to "Based on the given sentence {}, please determine whether the sentence belongs to type {}, where the types include = {equipment, fault, operation and maintenance, scheduling}";

[0067] Based on the obtained sentence type (Sentence_type), and according to the pre-designed corresponding type schema, construct the entity attribute extraction template (ie_prompt) to extract the entity attribute elements contained in the sentence.

[0068] S4. Obtain the task prompt template for the task type;

[0069] S5. Embed the target sentence and the preset power information type to which the target sentence belongs into the task prompt template to obtain the second input information. Input the second input information into the language model to obtain the information extraction result in the target sentence.

[0070] Specifically, the task types include relation extraction tasks, named entity recognition tasks, and event extraction tasks.

[0071] When the task type is a relation extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the relation extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity triple information. The entity to be verified includes the head entity, entity relation, and tail entity in the entity triple.

[0072] When the task type is named entity recognition task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the named entity recognition task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information. The entity to be verified includes the entity and entity type in the entity tuple.

[0073] When the task type is an event extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the event extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information, and the entity to be verified includes the event information entity in the entity tuple information.

[0074] Specifically, entity attribute extraction templates refer to setting different prompt templates according to different information extraction tasks, and then filling the input sentence into specific slots in the template.

[0075] The goal of the relation extraction task is to extract triples from the text. The corresponding prompt template is "The input sentence {} belongs to the {} type. Please extract entity triples from it and output them. The triple format is <head entity, relation, tail entity>".

[0076] Named entity recognition (NER) aims to extract entities from text. The corresponding prompt template is: "The input sentence {} belongs to type {}. Please extract all entities and their types from it and output them in the format <entity, entity type>, where entity type = {PER, ORG, PEM, ET}, where..." <per>Indicates a person's name. <org>Indicates the name of the organization. <pem>Indicates electrical equipment, <et>"Indicates power technology";

[0077] The event extraction task aims to extract events from text. The corresponding prompt template is "The input sentence {} belongs to the {} type. Please extract the time, place, people, main content, etc. involved in the event and output it in JSON format."

[0078] Input the prompt template obtained in the previous step into a large language model to obtain the information extraction task results.

[0079] S6. Input the entity to be verified and the entities in the power knowledge base into the similarity matching algorithm to obtain the similarity score between each entity in the power knowledge base and the entity to be verified.

[0080] S7. Determine whether there are entities in the power knowledge base with a similarity score greater than a preset score threshold;

[0081] If so, and the entity to be verified exists in the power knowledge base, then the entity to be verified is added to the candidate set.

[0082] Otherwise, if the entity to be verified does not exist in the power knowledge base, the verification prompt template and the language model are used to confirm whether the entity to be verified is an entity.

[0083] S8. Obtain the result verification prompt template, embed the entity to be verified into the result verification prompt template to obtain the third input information, input the third input information into the language model to obtain the judgment result of whether the entity to be verified is an entity;

[0084] S9. If yes, add the entity to be verified to the candidate set; otherwise, discard the entity to be verified and update the entity to be verified in the candidate set that is not stored in the power knowledge base to the power knowledge base.

[0085] S10. Output the information extraction results of the target sentence in JSON format.

[0086] Specifically, based on the obtained entities, the entity linking method is used to check whether the entity exists in the existing power knowledge base. If it exists, the result is added to the candidate set; if it does not exist, a result verification prompt template is designed to ask whether the entity extracted by the large language model is an entity. If it is an entity, it is added to the candidate set; otherwise, the entity is discarded.

[0087] The entity linking method for finding entities in the existing power knowledge base involves using a similarity matching method to search for the existence of the entity in the knowledge base based on the extraction results of a large language model. If the entity exists in the knowledge base and the similarity score is higher than a set threshold, it is added to the candidate set; otherwise, a result verification prompt template is designed, and the large language model is used again to determine whether it is an entity. If the answer is "yes", the result is added to the candidate set; otherwise, it is discarded.

[0088] For example, Example 1: Named Entity Recognition of Large Language Models

[0089] Sentence: The power grid is a part composed of transformers, power lines and other equipment that transform, transmit and distribute electrical energy.

[0090] Hint Template: "Based on the given sentence {The power grid is composed of transformers, power lines, and other equipment for transforming, transmitting, and distributing electrical energy}, please determine whether the sentence belongs to the {} type, where the type includes {equipment, fault, operation and maintenance, dispatch}."

[0091] Entity Attribute Extraction Template: "The input sentence {The power grid is a part composed of transformers, power lines, and other equipment for transforming, transmitting, and distributing electrical energy} belongs to the {Equipment} type. Please extract all entities and entity types from it and output them in the format <Entity, Entity Type>, where Entity Type = {PER, ORG, PEM, ET}, where..." <per>Indicates a person's name. <org>Indicates the name of the organization. <pem>Indicates electrical equipment, <et>"Indicates power technology"

[0092] Results: <Power grid, PEM>, <Transformer, PEM>, <Power line, PEM>, <Transformation, ET>, <Transmission, ET>, and <Distribution, ET>.

[0093] Example 2: Information Extraction from Large Language Models

[0094] Target sentence: Main transformer cooler system fan failure.

[0095] Hint template: "Based on the given sentence {main transformer cooler system fan failure}, please determine whether the sentence belongs to type {}, where the type includes {equipment, failure, operation and maintenance, dispatch}".

[0096] Entity Attribute Extraction Template: "The input sentence {main transformer cooler system fan failure} belongs to the {failure} type. Please extract entity triples from it and output them, where the triple format is <head entity, relation, tail entity>."

[0097] By linking entities to the power knowledge base, it was discovered that <main transformer, cooler system, fan> is also a triple. The design result judgment prompt template was then input into a large language model.

[0098] Results: "<Main transformer, cooling system, fan>", <Main transformer cooling system, fault, fan>

[0099] It should be understood that information extraction is a very traditional and widely used task in Natural Language Processing (NLP). Its goal is to extract structured information from unstructured text, including entity extraction, relation extraction, and event extraction. Entity extraction is the most mature task in information extraction. From HMM and CRF to BiLSTM, and then to Lattice LSTM and TENNER, entity recognition has made significant progress on standard datasets. With the advent of pre-trained models such as BERT, entity recognition has been further improved. Relation extraction generally uses supervised or remotely supervised classification models. Before the advent of deep learning, it mainly relied on manual features and kernel-based models. In the deep learning era, mainstream models include CNN and PCNN. Event extraction is the most difficult task, and its development is similar to relation extraction, with DMCNN being a representative example. Overall, information extraction research has made some progress, but problems such as difficulty in obtaining samples, complex text semantics, poor generalization ability, and poor practicality still exist. With the rapid development of deep learning technology, large language models such as GPT and LLaMA possess powerful understanding and generation capabilities. The general intelligence capabilities of large language models provide new ideas for information extraction tasks. However, large models face challenges in learning and understanding domain data, including difficulties in updating knowledge and identifying potential knowledge errors within the model.

[0100] Embodiment 2 of this application proposes a method for extracting power data information based on a large-scale language model, addressing the problems of traditional information extraction such as reliance on data and insufficient utilization of contextual information. It employs a knowledge base and a large-scale language model to collaboratively determine the extraction results, improving the extraction capabilities of the large-scale language model while simultaneously saving entities not existing in the knowledge base. This model, through information extraction and knowledge base completion using a large-scale language model and a domain knowledge base, helps solve the problem of traditional information extraction requiring large amounts of labeled data, while also improving the generalization performance and practicality of information extraction. Furthermore, this method is not limited to the power sector; it can be extended to other domains by constructing knowledge bases for large-scale language model information extraction and domain knowledge base completion. In addition, this application uses a power knowledge base to verify the extraction results of the large model and feeds them back to the large model, enhancing its information extraction capabilities while updating the final extraction results in the knowledge base, thus achieving the updating and expansion of the power knowledge base.

[0101] This application provides a method for extracting power knowledge information based on a large-scale language model, which can be applied to intelligent question answering and knowledge retrieval.

[0102] Example 3:

[0103] The following will be combined with the appendix Figure 3 The present application provides a description of a power data information extraction device based on a large language model, the device comprising:

[0104] The acquisition module is used to obtain the target sentence;

[0105] The first extraction module is used to obtain the preset power information type to which the target sentence belongs based on the target sentence, the preset power information extraction prompt template and the selected language model;

[0106] The second extraction module is used to obtain the task type set by the user, and obtain the information extraction result in the target sentence based on the target sentence, the task type and the language model. The information extraction result includes the entity to be verified.

[0107] The verification module is used to search for the existence of the entity to be verified in the power knowledge base through the entity linking method. If it exists, the entity to be verified is added to the candidate set; otherwise, the update module is executed.

[0108] The update module is used to confirm whether the entity to be verified is an entity through the result verification prompt template and the language model. If it is, the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded, and the entities to be verified in the candidate set that are not stored in the power knowledge base are updated to the power knowledge base.

[0109] The results output module outputs the information extraction results of the target sentence in JSON format.

[0110] Based on the above embodiments, the first extraction module is specifically used to embed the target sentence into a preset power information extraction prompt template to obtain the first input information;

[0111] Input the first input information into the selected language model to obtain the preset power information type to which the target sentence belongs.

[0112] Based on the above embodiments, the second extraction module is further configured to obtain the task prompt template of the task type.

[0113] The target sentence and its corresponding preset power information type are embedded into the task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result from the target sentence.

[0114] Based on the above embodiments, the task types further include relation extraction tasks, named entity recognition tasks, and event extraction tasks;

[0115] The second extraction module is specifically used to embed the target sentence and the preset power information type to which the target sentence belongs into the relation extraction task prompt template when the task type is a relation extraction task, to obtain the second input information, and to input the second input information into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity triple information, and the entity to be verified includes the head entity, entity relation and tail entity in the entity triple.

[0116] When the task type is named entity recognition task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the named entity recognition task prompt template to obtain the second input information. The second input information is input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information. The entity to be verified includes the entity and entity type in the entity tuple.

[0117] When the task type is an event extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the event extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information, and the entity to be verified includes the event information entity in the entity tuple information.

[0118] Based on the above embodiments, the verification module is specifically used to input the entity to be verified and the entities in the power knowledge base into a similarity matching algorithm to obtain a similarity score between each entity in the power knowledge base and the entity to be verified.

[0119] Determine whether an entity with a similarity score greater than a preset threshold exists in the power knowledge base;

[0120] If so, and the entity to be verified exists in the power knowledge base, then the entity to be verified is added to the candidate set.

[0121] Otherwise, if the entity to be verified does not exist in the power knowledge base, the verification prompt template and the language model are used to confirm whether the entity to be verified is an entity.

[0122] The third embodiment of this application provides a power data information extraction device based on a large language model, which solves the problems of traditional information extraction such as dependence on data and insufficient utilization of contextual information; it improves the extraction capability of large language models, and can save entities that do not exist in the knowledge base into the knowledge base. It also solves the problem that traditional information extraction requires a large amount of labeled data, and improves the generalization performance and practicality of information extraction.

[0123] Furthermore, embodiments of this application include a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the power data information extraction method based on a large language model as described in any of the above technical solutions.

[0124] This application also includes a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the power data information extraction method based on a large language model as described in any of the above technical solutions.

[0125] The above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.< / et> < / pem> < / org> < / per> < / et> < / pem> < / org> < / per>

Claims

1. A method for extracting power data information based on a large-scale language model, characterized in that, The method includes: Obtain the target sentence; Based on the target sentence, the preset power information extraction prompt template, and the selected language model, the preset power information type to which the target sentence belongs is obtained; Obtain the user-defined task type, and based on the target sentence, the task type, and the language model, obtain the information extraction result from the target sentence, which includes the entity to be verified. The entity to be verified is checked in the power knowledge base using the entity linking method. If it exists, the entity to be verified is added to the candidate set. Otherwise, the entity to be verified is confirmed as an entity by the result verification prompt template and the language model. If it is an entity, then the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded, and the entities to be verified in the candidate set that are not stored in the power knowledge base are updated to the power knowledge base. Output the information extraction results of the target sentence in JSON format; The step of confirming whether the entity to be verified is an entity through the result verification prompt template and the language model specifically includes: Obtain the result verification prompt template, embed the entity to be verified into the result verification prompt template to obtain third input information, input the third input information into the language model, and obtain the judgment result of whether the entity to be verified is an entity.

2. The method for extracting power data information based on a large-scale language model according to claim 1, characterized in that, The step of determining the preset power information type to which the target sentence belongs based on the target sentence, the preset power information extraction prompt template, and the selected language model specifically includes: The target sentence is embedded into a preset power information extraction prompt template to obtain the first input information; The first input information is input into the selected language model to obtain the preset power information type to which the target sentence belongs.

3. The method for extracting power data information based on a large-scale language model according to claim 1, characterized in that, The step of obtaining the user-defined task type and, based on the target sentence, the task type, and the language model, obtaining the information extraction result from the target sentence specifically includes: Obtain the task prompt template for the task type; The target sentence and the preset power information type to which the target sentence belongs are embedded into the task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence.

4. The method for extracting power data information based on a large-scale language model according to claim 3, characterized in that, The task types include relation extraction tasks, named entity recognition tasks, and event extraction tasks; The step of embedding the target sentence and its corresponding preset power information type into the task prompt template to obtain second input information, and then inputting the second input information into the language model to obtain the information extraction result from the target sentence, specifically includes: When the task type is a relation extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the relation extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity triple information, and the entity to be verified includes the head entity, entity relation, and tail entity in the entity triple. When the task type is a named entity recognition task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the named entity recognition task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information, and the entity to be verified includes the entity and entity type in the entity tuple. When the task type is an event extraction task, the target sentence and the preset power information type to which the target sentence belongs are embedded into the event extraction task prompt template to obtain the second input information. The second input information is then input into the language model to obtain the information extraction result of the target sentence. The information extraction result is entity tuple information, and the entity to be verified includes the event information entity in the entity tuple information.

5. The method for extracting power data information based on a large-scale language model according to claim 1, characterized in that, The step of checking whether the entity to be verified exists in the power knowledge base using the entity linking method specifically includes: The entity to be verified and the entities in the power knowledge base are input into a similarity matching algorithm to obtain a similarity score between each entity in the power knowledge base and the entity to be verified. Determine whether an entity with a similarity score greater than a preset threshold exists in the power knowledge base; If so, and the entity to be verified exists in the power knowledge base, then the entity to be verified is added to the candidate set. Otherwise, if the entity to be verified does not exist in the power knowledge base, the verification prompt template and the language model are used to confirm whether the entity to be verified is an entity.

6. A power data information extraction device based on a large-scale language model, characterized in that, The device includes: The acquisition module is used to obtain the target sentence; The first extraction module is used to obtain the preset power information type to which the target sentence belongs based on the target sentence, the preset power information extraction prompt template and the selected language model; The second extraction module is used to obtain the task type set by the user, and to obtain the information extraction result in the target sentence based on the target sentence, the task type and the language model. The information extraction result includes the entity to be verified. The verification module is used to search for the existence of the entity to be verified in the power knowledge base through the entity linking method. If it exists, the entity to be verified is added to the candidate set; otherwise, the update module is executed. The update module is used to confirm whether the entity to be verified is an entity through the result verification prompt template and the language model. If it is, the entity to be verified is added to the candidate set; otherwise, the entity to be verified is discarded, and the entities to be verified in the candidate set that are not stored in the power knowledge base are updated to the power knowledge base. The result output module outputs the information extraction results of the target sentence in JSON format. The step of confirming whether the entity to be verified is an entity through the result verification prompt template and the language model specifically includes: Obtain the result verification prompt template, embed the entity to be verified into the result verification prompt template to obtain third input information, input the third input information into the language model, and obtain the judgment result of whether the entity to be verified is an entity.

7. The power data information extraction device based on a large-scale language model according to claim 6, characterized in that, The first extraction module is specifically used to embed the target sentence into a preset power information extraction prompt template to obtain the first input information; The first input information is input into the selected language model to obtain the preset power information type to which the target sentence belongs.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the power data information extraction method based on a large language model as described in any one of claims 1 to 5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the power data information extraction method based on a large language model as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Named entity linking method based on knowledge base feature extraction

    CN108304552A

  • Knowledge extraction method and system of entity relationship combined triad

    CN116127921A