Knowledge graph construction method and device, equipment, storage medium and program product
By fine-tuning the initial large-scale information extraction model, a target information extraction large-scale model is generated, which solves the problem of low efficiency in knowledge graph construction, realizes automated and accurate triple extraction, and improves the construction efficiency and scalability of knowledge graphs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-17
- Publication Date
- 2026-03-13
AI Technical Summary
Existing technologies are inefficient, lack automation, and produce data that is singular and poorly scalable, especially in the power plant, oil, and new energy sectors.
By training the initial large-scale information extraction model based on the fine-tuned dataset, a target large-scale information extraction model is generated. This model is then used to extract entity, entity relationship, and attribute information from resource description information to construct a knowledge graph.
It achieves end-to-end automated and accurate triple extraction, improves the efficiency of knowledge graph construction, and supports rapid updates and expansion of knowledge graphs.
Smart Images

Figure CN121660056A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to a method, apparatus, device, storage medium and program product for constructing a knowledge graph. Background Technology
[0002] Against the backdrop of enterprise digital transformation, many sectors (such as power plants, petroleum, and new energy) urgently need to achieve automatic mapping from massive amounts of data to knowledge graphs in order to improve work efficiency, management efficiency, enterprise digitalization level, and data visualization effects.
[0003] Currently, the construction of knowledge graphs typically begins with domain experts manually defining an ontology framework (including entity types, relationship rules, attributes, etc.) based on business needs, and developing corresponding information extraction rules such as regular expressions and keyword matching. Then, based on this ontology framework and extraction rules, entities, relationships, and attributes conforming to the rules are extracted from the raw data. Significant manual intervention is then required for data cleaning, alignment, and fusion. Finally, the knowledge graph is constructed according to the ontology framework, based on the extracted entities, relationships, and attributes. However, the current efficiency of knowledge graph construction is relatively low. Summary of the Invention
[0004] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for constructing knowledge graphs, which can improve the efficiency of knowledge graph construction.
[0005] In a first aspect, embodiments of this application provide a method for constructing a knowledge graph, the method comprising: Obtain resource description information in the target domain; The target information extraction model extracts entities, relationships between entities, and attribute information of entities from the resource description information, resulting in entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning a first information extraction model based on a fine-tuning dataset. The first information extraction model is obtained by pre-training an initial information extraction model based on first resource description sample information. The fine-tuning dataset includes second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels. The entity includes an entity identifier and an entity type. Based on the entity-relationship-entity triples and the entity-attribute-attribute value triples, a knowledge graph of the target domain is constructed.
[0006] In one possible implementation, before extracting entities, relationships between entities, and attribute information from the resource description information through the target information extraction model to obtain entity-relationship-entity triples and entity-attribute-attribute value triples, the method further includes: Obtain the fine-tuning dataset; The first information is used to extract a large model, and prediction triples are extracted from the second resource description sample information. The first loss function value is determined based on the similarity between the predicted triplet and the triplet label; If the first loss function value is greater than the first preset threshold, adjust the model parameters of the first information extraction model and return to the execution of the first information extraction model to extract predicted triples from the second resource description sample information until the first loss function value is less than or equal to the first preset threshold, thus obtaining the target information extraction model.
[0007] In one possible implementation, obtaining the fine-tuning dataset includes: Obtain the second resource description sample information; By extracting large models from zero-sample information, entity labels and their corresponding entity label types are extracted from the second resource description sample information; Using the zero-sample information extraction model, based on the entity tags and their corresponding entity tag types, the association relationship between the entity tags is extracted from the second resource description sample information to obtain entity tag-relationship tag-entity tag triplets, and the attribute information of the entity tags is extracted from the second resource description sample information to obtain entity tag-attribute tag-attribute value tag triplets. Based on the entity tag-relationship tag-entity tag triple and the entity tag-attribute tag-attribute value tag triple, determine the initial tag of the triple; The initial labels of the triplets are verified and corrected to obtain triplet labels; The fine-tuning dataset is determined based on the second resource description sample information and the triplet labels.
[0008] In one possible implementation, the step of extracting the large model using zero-sample information, based on the entity tags and their corresponding entity tag types, extracting the association relationships between the entity tags from the second resource description sample information to obtain entity tag-relationship tag-entity tag triples, and extracting the attribute information of the entity tags from the second resource description sample information to obtain entity tag-attribute tag-attribute value tag triples, includes: By using the zero-sample information extraction model, based on the entity labels and their corresponding entity label types, the association between the entity labels is extracted from the second resource description sample information to obtain entity label-relationship label-entity label triplets, as well as the basis for generating the entity label-relationship label-entity label triplets; Using the zero-sample information extraction model, based on the entity label and its corresponding entity label type, the attribute information of the entity label is extracted from the second resource description sample information to obtain the entity label-attribute label-attribute value label triplet, and the basis for generating the entity label-attribute label-attribute value label triplet; The step of determining the fine-tuning dataset based on the second resource description sample information and the triplet labels includes: Based on the generation criteria of the entity tag-relationship tag-entity tag triplet and the generation criteria of the entity tag-attribute tag-attribute value tag triplet, the generation criteria of the triplet tags are determined; The fine-tuning dataset is determined based on the second resource description sample information, the triplet labels, and the basis for generating the triplet labels.
[0009] In one possible implementation, before extracting predicted triples from the second resource description sample information using the first information extraction large model, the method further includes: Obtain the first resource description sample information; Randomly select multiple information fragments from the first resource description sample information; In the first resource description sample information, the multiple information fragments are replaced with multiple mask fragments to obtain the third resource description sample information; By adding placeholders corresponding to the multiple information fragments to the third resource description sample information, a fourth resource description sample information is obtained. The large model is extracted using the initial information, and the predicted fragments corresponding to the multiple placeholders are predicted based on the fourth resource description sample information. The second loss function value is determined based on the similarity between the predicted segment and the information segment; If the value of the second loss function is greater than the second preset threshold, the model parameters of the initial information extraction large model are adjusted, and the process of predicting the prediction segments corresponding to the multiple placeholders based on the third resource description sample information is returned until the value of the second loss function is less than or equal to the second preset threshold, thus obtaining the first information extraction large model.
[0010] In one possible implementation, the fourth resource description sample information includes multiple resource-related data, each resource-related data containing n placeholders, where n is a positive integer greater than 1. The step of predicting the prediction segments corresponding to the multiple placeholders based on the fourth resource description sample information includes: For each piece of resource-related data, obtain the prediction order corresponding to each of the n placeholders; For each piece of resource-related data, for the i-th placeholder, based on the resource-related data and the prediction segments corresponding to the 1st to i-1th placeholders respectively, predict the prediction segment corresponding to the i-th placeholder, where i is a positive integer greater than 1 and not greater than n.
[0011] In one possible implementation, obtaining the first resource description sample information includes: Obtain original resource description sample information of the target domain, wherein the original resource description sample information includes multiple original sample data; The original sample data are processed to have a uniform length, resulting in multiple sample data with the same length. Based on multiple sample data of the same length, the first resource description sample information is determined.
[0012] Secondly, embodiments of this application provide a knowledge graph construction apparatus, the apparatus comprising: The first acquisition module is used to acquire resource description information in the target domain; The first extraction module is used to extract entities, relationships between entities, and attribute information of entities from the resource description information using a target information extraction model, thereby obtaining entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning a first information extraction model based on a fine-tuning dataset. The first information extraction model is obtained by pre-training an initial information extraction model based on first resource description sample information. The fine-tuning dataset includes second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels. The entity includes an entity identifier and an entity type. The construction module is used to construct a knowledge graph of the target domain based on the entity-relationship-entity triple and the entity-attribute-attribute value triple.
[0013] Thirdly, embodiments of this application provide an electronic device, which includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements any of the possible implementations of the first aspect described above.
[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the method in any of the possible implementations of the first aspect described above.
[0015] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform a method as described in any of the possible implementations of the first aspect above.
[0016] In this embodiment, an initial large-scale information extraction model is pre-trained based on first resource description sample information of the target domain to obtain a first large-scale information extraction model. This allows the first large-scale information extraction model to become familiar with the form and distribution of massive data in the target domain, providing a foundational understanding for domain adaptation in subsequent information extraction. Since triple tags include entity-relation-entity triple tags and entity-attribute-attribute value triple tags, and an entity includes an entity identifier and an entity type, the target large-scale information extraction model is obtained by fine-tuning the first large-scale information extraction model based on a fine-tuned dataset including second resource description sample information and its corresponding triple tags. This transforms the previously accumulated domain knowledge into accurate triple extraction capabilities, enabling the target large-scale information extraction model to accurately extract triples from the resource description information of the target domain. Thus, by using a large-scale target information extraction model, entities, the relationships between entities, and entity attribute information are extracted from resource description information to obtain entity-relationship-entity triples and entity-attribute-attribute value triples. This enables end-to-end automated and accurate triple extraction, thereby improving the efficiency of triple extraction. Furthermore, by constructing a knowledge graph based on entity-relationship-entity triples and entity-attribute-attribute value triples, the efficiency of knowledge graph construction can be improved. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a method for constructing a knowledge graph according to an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a knowledge graph construction apparatus provided in one embodiment of this application; Figure 3 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0019] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.
[0020] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0021] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.
[0022] Currently, knowledge graph research in many fields such as power plants, petroleum, and new energy is in its initial stage, and the construction of knowledge graphs suffers from problems such as low automation, low efficiency, single data, and poor scalability.
[0023] To address the related technical issues, embodiments of this application provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for constructing a knowledge graph.
[0024] The method for constructing a knowledge graph provided in the embodiments of this application will be described below.
[0025] Figure 1 A flowchart illustrating a method for constructing a knowledge graph according to an embodiment of this application is shown. Figure 1 As shown, the knowledge graph construction method provided in this application includes the following steps: S110. Obtain resource description information for the target domain; S120. Using the target information extraction model, entities, relationships between entities, and attribute information of entities are extracted from resource description information to obtain entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning the first information extraction model based on the fine-tuning dataset. The first information extraction model is obtained by pre-training the initial information extraction model based on the first resource description sample information. The fine-tuning dataset includes the second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels. The entity includes entity identifier and entity type. S130. Construct a knowledge graph for the target domain based on entity-relationship-entity triples and entity-attribute-attribute value triples.
[0026] In this embodiment, an initial large-scale information extraction model is pre-trained based on first resource description sample information of the target domain to obtain a first large-scale information extraction model. This allows the first large-scale information extraction model to become familiar with the form and distribution of massive data in the target domain, providing a foundational understanding for domain adaptation in subsequent information extraction. Since triple tags include entity-relation-entity triple tags and entity-attribute-attribute value triple tags, and an entity includes an entity identifier and an entity type, the target large-scale information extraction model is obtained by fine-tuning the first large-scale information extraction model based on a fine-tuned dataset including second resource description sample information and its corresponding triple tags. This transforms the previously accumulated domain knowledge into accurate triple extraction capabilities, enabling the target large-scale information extraction model to accurately extract triples from the resource description information of the target domain. Thus, by using a large-scale target information extraction model, entities, the relationships between entities, and entity attribute information are extracted from resource description information to obtain entity-relationship-entity triples and entity-attribute-attribute value triples. This enables end-to-end automated and accurate triple extraction, thereby improving the efficiency of triple extraction. Furthermore, by constructing a knowledge graph based on entity-relationship-entity triples and entity-attribute-attribute value triples, the efficiency of knowledge graph construction can be improved.
[0027] The specific implementation methods for each of the above steps are described below.
[0028] In some embodiments, in S110, the target domain can be any one of many domains such as power plant domain, oil domain, and new energy domain. Resource description information can be used to describe the resources in the target domain. The resource description information can include multiple pieces of resource-related data. This amount of resource-related data is massive.
[0029] As an example, if the target domain is the power plant domain, the resources can include plant buildings, systems, equipment, components, etc. The resource description information can include massive amounts of power plant data extracted from the power plant's point table, the power plant identification system (Kraftwerk-Kennzeichen-System, KKS) coding table, and equipment logs.
[0030] In addition, when the resource description information includes a large amount of resource-related data, the embodiments of this application can process the large amount of resource-related data of different lengths into a uniform length in order to meet the needs of batch data processing in the model application process, thereby improving the efficiency and stability of extracting triples from the resource description information.
[0031] In some embodiments, in S120 and S130, a knowledge graph is a collection of knowledge represented by a graph structure, where knowledge is stored and represented using "triples". In a knowledge graph, entities are the basic elements, relations represent the associations between different entities, attributes describe the entities, and values represent the specific attribute values. In a knowledge graph, the relationships between entities and relations, and between attributes, can be represented by "entity-relationship-entity" triples. Assuming that the attributes of an entity are viewed as mappings between the entity and its attribute values, then the attribute information of an entity can be transformed into the following triple form: "entity-attribute-attribute value". That is, attribute extraction can be seen as a special type of triple extraction task. When entities are represented using nodes, and the relationships or attributes between entities are represented using edges, a network-like graph structure is formed, resulting in a knowledge graph.
[0032] Entity types, relationship types, and attributes may differ across different domains. Taking the power plant domain as an example, entity types may include buildings, systems, equipment, and components; relationship types may include "located in," "contains," "controls," and "monitors"; and attributes may include temperature, model, location, status, and entity description.
[0033] Furthermore, the initial information extraction model, the first information extraction model, and the target information extraction model can all be large language models based on the Chat General Language Model (ChatGLM). The first and second resource description sample information can be used to describe resources in the target domain. Both the first and second resource description sample information can include multiple resource-related data points. These multiple resource-related data points are massive. In the fine-tuning dataset, each resource-related data point in the second resource description sample information can correspond to a triplet label. Each triplet label can include two parts: an entity-relationship-entity triplet label and an entity-attribute-attribute value triplet label. The entity in the triplet label can include an entity identifier and an entity type. Therefore, the entity-relationship-entity triplet label can also be represented as (entity 1: entity type 1, relation type 1-2, entity 2: entity type 2). Here, entity 1 and entity 2 are entity identifiers, and relation type 1-2 represents the relationship between entity 1 and entity 2. Additionally, the entity-attribute-attribute-value triplet tag can also be represented in the form of (entity1: entity type1, attribute1, value of attribute1). Furthermore, the first resource description sample information and the second resource description sample information can be the same or different; this is not limited here.
[0034] Specifically, the initial information extraction model can be a large model lacking target domain knowledge. By pre-training the initial model with massive amounts of data from the first resource description sample information, a first information extraction model is obtained. This first model becomes familiar with the form and distribution of massive data in the target domain, thus acquiring target domain knowledge. Based on this, the first model is fine-tuned using the aforementioned fine-tuning dataset to obtain the target information extraction model. This model transforms the previously accumulated target domain knowledge into accurate triplet extraction capabilities, enabling it to accurately extract triples from the resource description information of the target domain.
[0035] Building upon this foundation, in practical applications, after inputting resource description information into the target information extraction model and providing prompts to instruct it to extract triples, the model can extract entities, relationships between entities, and entity attribute information from the resource description information in the form of triples, based on the knowledge provided by the prompts. This results in entity-relationship-entity triples and entity-attribute-attribute-value triples. In these triples, an entity can include an entity identifier and an entity type. Therefore, an entity-relationship-entity triple can also be represented as (entity 1: entity type 1, relation type 1-2, entity 2: entity type 2). Similarly, an entity-attribute-attribute-value triple can be represented as (entity 1: entity type 1, attribute 1, value of attribute 1). After obtaining these triples, a knowledge graph for the target domain can be constructed.
[0036] Therefore, through the embodiments of this application, a twin knowledge graph can be automatically constructed based on massive amounts of unstructured data. By extracting triples from this data, an automated mapping from massive data to a knowledge graph is achieved, solving problems such as low automation, low efficiency, and limited data. Furthermore, each time a new entity type or relation type is added, only the target information extraction model needs to be fine-tuned based on the new content, and triples are extracted based on the fine-tuned target information extraction model to update the knowledge graph, thus solving the problem of poor scalability of knowledge graphs.
[0037] In this embodiment, the knowledge graph is a twin knowledge graph corresponding to the real physical scenario. Taking a power plant as an example, in this embodiment, based on massive amounts of power plant data extracted from the power plant's point table, KKS coding table, and equipment logs, the real physical objects are broken down into graph nodes. Using "system-equipment-component" as the core framework, graph technology semantically maps their hierarchy, connections, attributes, events, etc., to the digital world, forming a "digital mirror" isomorphic to the real power plant, providing a solid foundation for intelligent analysis, predictive maintenance, and optimized operation.
[0038] In addition, for each entity, the entity identifier and its corresponding entity type, attribute information and other descriptive information can be saved in dictionary form to achieve matching and alignment from knowledge graph to real physical entities.
[0039] Building upon this, to enable the target information extraction model to accurately extract triples from resource description information in the target domain, in some embodiments, prior to S120 above, the knowledge graph construction method may further include a process of fine-tuning the first information extraction model based on a fine-tuning dataset to obtain the target information extraction model. The fine-tuning process is as follows: Obtain the fine-tuning dataset; By using the first information extraction model, predictive triples are extracted from the second resource description sample information; The value of the first loss function is determined based on the similarity between the predicted triplet and the triplet label. If the first loss function value is greater than the first preset threshold, adjust the model parameters of the first information extraction model and return to execute the first information extraction model to extract predicted triples from the second resource description sample information until the first loss function value is less than or equal to the first preset threshold, thus obtaining the target information extraction model.
[0040] Here, the fine-tuning dataset may include second resource description sample information and its corresponding triplet labels. The second resource description sample information may include multiple (e.g., 5,000) resource-related data points. Each resource-related data point in the second resource description sample information may correspond to a triplet label. Each triplet label may include two parts: an entity-relationship-entity triplet label and an entity-attribute-attribute-value triplet label. The fine-tuning dataset can be obtained through manual annotation or model annotation; this is not limited here. Additionally, the predicted triples may include two parts: entity-relationship-entity predicted triples and entity-attribute-attribute-value predicted triples.
[0041] As an example, after inputting the fine-tuned dataset into the first information extraction model, for each piece of resource-related data in the second resource description sample information, the first information extraction model can extract the corresponding entity-relationship-entity triplet and entity-attribute-attribute value triplet, obtaining the entity-relationship-entity predicted triplet and the entity-attribute-attribute value predicted triplet. It then compares the similarity between the entity-relationship-entity predicted triplet and its label, as well as the similarity between the entity-attribute-attribute value predicted triplet and its label. Subsequently, based on the similarity between the entity-relationship-entity predicted triplet and its label, and the similarity between the entity-attribute-attribute value predicted triplet and its label, the similarity between the predicted triplet and its label for that piece of data can be determined. Finally, based on the similarity between the predicted triplet and its label for multiple pieces of resource-related data in the second resource description sample information, the first loss function value can be determined. If the first loss function value is less than or equal to the first preset threshold, the first information extraction model can be identified as the target information extraction model. If the first loss function value is greater than the first preset threshold, it can be determined that the first information extraction model cannot accurately extract triples. Therefore, the model parameters of the first information extraction model can be adjusted, and the above steps of triple extraction, similarity determination, and first loss function value calculation can be repeated until the first loss function value is less than or equal to the first preset threshold. At this point, the fine-tuning stops, and the fine-tuned first information extraction model is identified as the target information extraction model.
[0042] This application embodiment fine-tunes the first information extraction model based on a fine-tuned dataset including second resource description sample information and its corresponding triplet labels to obtain a target information extraction model, enabling the target information extraction model to accurately extract triples from resource description information in the target domain.
[0043] As mentioned above, the fine-tuning dataset can be obtained through manual annotation or model annotation. Therefore, to reduce the cost of manual annotation and improve annotation efficiency, in some embodiments, obtaining the fine-tuning dataset may specifically include: Obtain sample information for the second resource description; By extracting large models from zero-sample information, entity labels and their corresponding entity label types are extracted from the second resource description sample information; By extracting large models from zero-sample information, based on entity labels and their corresponding entity label types, the association between entity labels is extracted from the second resource description sample information to obtain entity label-relationship label-entity label triplets, and the attribute information of entity labels is extracted from the second resource description sample information to obtain entity label-attribute label-attribute value label triplets. Determine the initial labels of the triples based on the entity label-relation label-entity label triples and the entity label-attribute label-attribute value label triples; The initial labels of the triplets are validated and corrected to obtain the triplet labels. Based on the second resource description sample information and triplet labels, the fine-tuning dataset is determined.
[0044] Here, the large-scale zero-shot information extraction model can include a Chat Generative Pre-trained Transformer (ChatGPT) and a Chat-based Information Extraction (ChatIE) tool. ChatIE utilizes ChatGPT to achieve zero-shot information extraction, meaning it doesn't require labeled samples. It uses ChatGPT as a foundation and then completes the front-end and back-end to directly perform information extraction tasks such as entity and relation extraction.
[0045] As an example, after obtaining the second resource description sample information, the second resource description sample information and the prompt words used to prompt the zero-shot information extraction model to perform information extraction can be input together into the zero-shot information extraction model for information extraction. The information extraction process based on the zero-shot information extraction model can include two stages. The first stage can be used for entity extraction, and the second stage can be used for relation extraction and attribute extraction. In addition, the prompt words can include a first prompt word to instruct the model to perform entity extraction, a second prompt word to instruct the model to perform relation extraction, and a third prompt word to instruct the model to perform attribute extraction. The first prompt word can be, for example, "Given a list of entity types: [entity type 1, entity type 2, ...], the input sentence is: ***, what entities are included in this sentence, and what are the types of these entities? Please output the corresponding results in the following list format: [entity 1: entity type 1, entity 2: entity type 2, ...], where entity 1 is the entity extracted from the sentence, entity type 1 is the type corresponding to entity 1, and so on." Here, the sentence can represent resource-related data. The second prompt could be something like this: "Given relation types [relation type 1, relation type 2, ...], the input sentence is: ***, which contains the following entities [entity 1: entity type 1, entity 2: entity type 2, ...], what are the relationships between any two of these entities? Please output the corresponding results in the following list format: [(entity 1: entity type 1, relation type 1-2, entity 2: entity type 2), ...]. Relation type 1-2 represents the relationship between entity 1 and entity 2, and so on. If there is no relationship between two entities, then it is unnecessary to output it." The third prompt could be something like, "The input sentence is: ***, which contains the following entities [Entity 1: Entity Type 1, Entity 2: Entity Type 2, ...]. What attributes do these entities have, and what are their corresponding attribute values? Please output the results in the following list format: [(Entity 1: Entity Type 1, Attribute 1, Value of Attribute 1), ...], and explain why this result is obtained. One entity may correspond to multiple attributes. If an entity has no attributes, it does not need to be output; if the attribute value is not given, the attribute value is defined as Null." Using the third prompt, attribute extraction can be viewed as a special type of triple extraction task, thus simplifying the attribute extraction process.
[0046] Based on this, a large model can be extracted using zero-sample information. First, entity labels and their corresponding entity label types are extracted from the second resource description sample information. Then, based on the entity labels and their corresponding entity label types, the relationships between entity labels are extracted from the second resource description sample information, resulting in entity label-relationship label-entity label triples. Additionally, attribute information of the entity labels is extracted from the second resource description sample information, resulting in entity label-attribute label-attribute value label triples. These entity label-relationship label-entity label triples and entity label-attribute label-attribute value label triples can be jointly determined as the initial triple labels. Afterward, by validating and correcting the initial triple labels, accurate triple label labels can be obtained. Therefore, based on the second resource description sample information and the triple label labels, an accurate fine-tuning dataset can be determined.
[0047] This embodiment of the application first uses a large-scale zero-shot information extraction model to extract initial triplet labels, and then verifies and corrects these initial triplet labels to obtain the final triplet labels. This reduces the cost of manual annotation and improves annotation efficiency. Furthermore, when using the large-scale zero-shot information extraction model for initial triplet label extraction, entity extraction in the first stage can filter out unnecessary information in advance, reducing search and computational complexity. In the second stage, relation extraction and attribute extraction are performed based on the information extraction results from the first stage, achieving zero-shot information extraction.
[0048] Based on this, in order to improve the accuracy of triple extraction by the large model for target information extraction, in some embodiments, the above-mentioned large model for zero-sample information extraction extracts the relationship between entity tags from the second resource description sample information based on entity tags and their corresponding entity tag types, obtaining entity tag-relationship tag-entity tag triples, and extracts the attribute information of entity tags from the second resource description sample information, obtaining entity tag-attribute tag-attribute value tag triples. Specifically, this may include: By extracting large models from zero-sample information, based on entity labels and their corresponding entity label types, the association between entity labels is extracted from the second resource description sample information, resulting in entity label-relationship label-entity label triples, and the basis for generating entity label-relationship label-entity label triples. By extracting large models from zero-sample information, based on entity labels and their corresponding entity label types, attribute information of entity labels is extracted from the second resource description sample information to obtain entity label-attribute label-attribute value label triplets, as well as the basis for generating entity label-attribute label-attribute value label triplets.
[0049] Based on this, the above-mentioned determination of the fine-tuning dataset based on the second resource description sample information and triplet labels may specifically include: Based on the generation criteria of entity tag-relation tag-entity tag triples and entity tag-attribute tag-attribute value tag triples, the generation criteria of triple tags are determined. Based on the second resource description sample information, triplet labels, and the basis for generating triplet labels, the fine-tuning dataset is determined.
[0050] Here, the second and third prompts can also include prompts instructing the zero-shot information extraction model to provide the basis for generating the triples. For example, the second prompt could be "Given relation type... [(Entity 1: Entity type 1, Relation type 1-2, Entity 2: Entity type 2), ...], and explain why this result is obtained...". The third prompt could be "Input sentence is... [(Entity 1: Entity type 1, Attribute 1, Value of Attribute 1), ...], and explain why this result is obtained...". The ellipsis in the second and third prompts corresponds to the parts described above and will not be repeated here. Thus, when the zero-shot information extraction model outputs entity label-relation label-entity label triples and entity label-attribute label-attribute value label triples, it can also simultaneously output the basis for generating entity label-relation label-entity label triples and the basis for generating entity label-attribute label-attribute value label triples. Therefore, the fine-tuning dataset includes not only the second resource description sample information and triple labels, but also the basis for generating the triple labels.
[0051] This application's embodiments, by adding instructions to the second and third prompt words to guide the large model in generating triplet outputs from zero-sample information extraction, essentially requiring the large model to explain why it arrives at such a result, can guide the large model's thinking and generate a series of intermediate reasoning steps, significantly improving its ability to perform complex reasoning and endowing it with the ability to generate thought-chain-like structures. By adding the generation criteria for triplet labels when constructing the fine-tuning dataset, the information extraction-related thinking ability of the target information extraction large model can be explicitly trained, greatly improving its logical reasoning ability, thereby increasing the accuracy of information extraction and, to a certain extent, enhancing the credibility and interpretability of the large model's information extraction.
[0052] Furthermore, to enable the first information extraction model to become familiar with the form and distribution of massive amounts of data in the target domain, and to better understand the contextual relationships of data in the target domain, thus providing a foundational understanding for domain adaptation in information extraction, in some embodiments, before extracting predicted triples from the second resource description sample information using the first information extraction model, the knowledge graph construction method may further include a process of pre-training the initial information extraction model based on the first resource description sample information to obtain the first information extraction model. The pre-training process can be as follows: Obtain the first resource description sample information; Multiple information fragments were randomly selected from the first resource description sample information; In the first resource description sample information, multiple information fragments are replaced with multiple mask fragments to obtain the third resource description sample information; Add placeholders corresponding to multiple information fragments to the third resource description sample information to obtain the fourth resource description sample information; By extracting initial information into a large model, and based on the fourth resource description sample information, predict the predicted fragments corresponding to multiple placeholders respectively. The value of the second loss function is determined based on the similarity between the predicted fragment and the information fragment; If the second loss function value is greater than the second preset threshold, adjust the model parameters of the initial information extraction large model, and return to execute the prediction of multiple placeholders based on the third resource description sample information until the second loss function value is less than or equal to the second preset threshold, thus obtaining the first information extraction large model.
[0053] Here, the first resource description sample information includes multiple resource-related data points. Randomly selecting multiple information fragments from the first resource description sample information can involve randomly selecting one or more information fragments from each resource-related data point. Then, replacing these multiple information fragments with multiple mask fragments yields the third resource description sample information. For each resource-related data point, a placeholder corresponding to an information fragment can be added to the end of that data. If there are multiple placeholders, their order can be random. Then, using the initial information extraction model, based on the context information of the fourth resource description sample information, the predicted fragments corresponding to the multiple placeholders can be predicted. Finally, based on the similarity between the multiple predicted fragments and their corresponding information fragments, the second loss function value can be determined. If the second loss function value is less than or equal to a second preset threshold, the initial information extraction model can be determined as the first information extraction model. If the second loss function value is greater than the second preset threshold, it can be determined that the initial information extraction model cannot accurately understand the contextual dependencies of the target domain data. Therefore, the model parameters of the initial information extraction model can be adjusted, and the above steps of predicting the predicted segment, determining the similarity, and calculating the second loss function value can be repeated until the second loss function value is less than or equal to the second preset threshold. At this point, pre-training is stopped, and the pre-trained initial information extraction model is determined as the first information extraction model.
[0054] This application embodiment pre-trains an initial large-scale information extraction model based on the first resource description sample information to obtain a first large-scale information extraction model. This enables the first large-scale information extraction model to become familiar with the form and distribution of massive data in the target domain, and to better understand the contextual relationships of data in the target domain, thus providing a basic understanding of domain adaptation for information extraction.
[0055] Furthermore, the fourth resource description sample information may include multiple resource-related data entries, each containing n placeholders, where n is a positive integer greater than 1. Based on this, to improve the accuracy of the predicted segments, in some embodiments, the above-mentioned prediction of the predicted segments corresponding to multiple placeholders based on the fourth resource description sample information may specifically include: For each piece of resource-related data, obtain the prediction order corresponding to each of the n placeholders; For each piece of resource-related data, for the i-th placeholder, based on the resource-related data and the predicted segments corresponding to the 1st to i-1th placeholders respectively, predict the predicted segment corresponding to the i-th placeholder, where i is a positive integer greater than 1 and not greater than n.
[0056] Here, the order of the n placeholders can be random. After randomly determining the order of the placeholders, this order can be used to determine the prediction order corresponding to each placeholder. Specifically, for each piece of resource-related data, the prediction segment corresponding to the first placeholder can be predicted based on the resource-related data. From the second placeholder to the nth placeholder, the prediction segment corresponding to that placeholder can be determined jointly based on the resource-related data and the previously predicted segments.
[0057] As an example, when pre-training a large model for first information extraction, the training objective can be represented by the following equation (1): (1) For a certain resource-related data, if the resource-related data includes multiple information fragments such as x1, x2, x3, x4, x5, x6 arranged in sequence, and x3, x5, x6 are replaced with mask fragments [M] respectively, then Part A: x1, x2, [M], x4, [M], [M] and Part B: x3, x5, x6.
[0058] Based on this, This can be the input from Part A. The token sequence to be generated (i.e., the predicted fragments corresponding to multiple placeholders). For Part B in The left side (if) for , Then it is (And so on). In generating During the process, it is generated in order from left to right. Multiple tokens in the middle, i.e., generating span The probability is decomposed into: (2) in, for The first in Tokens for The number of tokens in the system.
[0059] In this way, by considering not only the resource-related data itself but also the already predicted segments when predicting the predicted segments corresponding to i placeholders, the accuracy of the predicted segments can be improved.
[0060] Furthermore, in order to improve the pre-training efficiency and stability of large models for initial information extraction, in some embodiments, the above-mentioned acquisition of the first resource description sample information may specifically include: Obtain original resource description sample information for the target domain, which includes multiple original sample data. Multiple original sample data are processed to have the same length, resulting in multiple sample data with the same length. Based on multiple sample data of the same length, the first resource description sample information is determined.
[0061] Here, the original sample data can be resource-related data. In the original resource description sample information, multiple original sample data entries have varying lengths. When performing uniform length processing, the length of each data entry can be preset, such as 2048. That is, the length of each sample data entry can be 2048. For original sample data entries shorter than 2048, padding can be used to increase the data length; for original sample data entries longer than 2048, truncation can be used to split the data into multiple data entries. If the length of any of the split data entries is less than 2048, padding can be used to increase the data length to 2048.
[0062] In this way, by determining the first resource description sample information based on multiple sample data of the same length, and then pre-training the initial information extraction large model based on the first resource description sample information, it is possible to ensure that the computational load and memory consumption of the model are within a controllable range, meet the needs of batch data processing during model training, and thus improve the pre-training efficiency and stability of the initial information extraction large model.
[0063] In summary, this application innovatively proposes to achieve automated virtual-real data mapping using scalable knowledge graphs. Specifically, leveraging the powerful expressive and generalization capabilities of the ChatGLM large model, the large model is incrementally pre-trained and efficiently fine-tuned based on massive amounts of data in the target domain to automatically construct a twin knowledge graph that maps to real physical entities.
[0064] Based on the knowledge graph construction method provided in the above embodiments, this application also provides specific implementations of the knowledge graph construction apparatus. Please refer to the following embodiments.
[0065] like Figure 2 As shown, a knowledge graph construction apparatus 200 provided in one embodiment of this application includes the following modules: The first acquisition module 210 is used to acquire resource description information of the target domain; The first extraction module 220 is used to extract entities, relationships between entities, and attribute information of entities from resource description information through a target information extraction model, thereby obtaining entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning the first information extraction model based on the fine-tuning dataset. The first information extraction model is obtained by pre-training the initial information extraction model based on the first resource description sample information. The fine-tuning dataset includes the second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels, wherein the entity includes entity identifier and entity type. Module 230 is used to construct a knowledge graph for the target domain based on entity-relationship-entity triples and entity-attribute-attribute value triples.
[0066] The knowledge graph construction device 200 described above will be explained in detail below: In some embodiments, the knowledge graph construction apparatus 200 may further include: The second acquisition module is used to acquire the fine-tuning dataset; The second extraction module is used to extract predicted triples from the second resource description sample information by extracting the large model through the first information. The first determining module is used to determine the value of the first loss function based on the similarity between the predicted triples and the triple labels; The first training module is used to adjust the model parameters of the first information extraction model when the first loss function value is greater than the first preset threshold, and then return to execute the first information extraction model to extract predicted triples from the second resource description sample information until the first loss function value is less than or equal to the first preset threshold, thus obtaining the target information extraction model.
[0067] In some embodiments, the second acquisition module may specifically include: The first acquisition submodule is used to acquire the second resource description sample information; The first extraction submodule is used to extract a large model using zero-sample information and extract entity labels and their corresponding entity label types from the second resource description sample information. The second extraction submodule is used to extract large models using zero-sample information. Based on entity labels and their corresponding entity label types, it extracts the association relationship between entity labels from the second resource description sample information to obtain entity label-relationship label-entity label triplets, and extracts the attribute information of entity labels from the second resource description sample information to obtain entity label-attribute label-attribute value label triplets. The first determination submodule is used to determine the initial label of the triple based on the entity label-relationship label-entity label triple and the entity label-attribute label-attribute value label triple; The correction submodule is used to verify and correct the initial labels of triples to obtain triple labels; The second determination submodule is used to determine the fine-tuning dataset based on the sample information of the second resource description and the triplet labels.
[0068] In some embodiments, the second extraction submodule may specifically include: The first extraction unit is used to extract the large model through zero-sample information. Based on entity labels and their corresponding entity label types, it extracts the relationship between entity labels from the second resource description sample information to obtain entity label-relationship label-entity label triplets, as well as the basis for generating entity label-relationship label-entity label triplets. The second extraction unit is used to extract the large model through zero-sample information. Based on the entity label and its corresponding entity label type, it extracts the attribute information of the entity label from the second resource description sample information to obtain the entity label-attribute label-attribute value label triplet and the basis for generating the entity label-attribute label-attribute value label triplet.
[0069] Based on this, the second determining submodule may specifically include: The first determining unit is used to determine the basis for generating triplet labels based on the basis for generating entity label-relationship label-entity label triplets and the basis for generating entity label-attribute label-attribute value label triplets. The second determining unit is used to determine the fine-tuning dataset based on the second resource description sample information, triplet labels, and the basis for generating triplet labels.
[0070] In some embodiments, the knowledge graph construction apparatus 200 may further include: The third acquisition module is used to acquire the first resource description sample information; The selection module is used to randomly select multiple information fragments from the first resource description sample information; The replacement module is used to replace multiple information fragments with multiple mask fragments in the first resource description sample information to obtain the third resource description sample information; The module is used to add placeholders corresponding to multiple information fragments in the third resource description sample information to obtain the fourth resource description sample information. The prediction module is used to extract a large model from the initial information and predict the prediction segments corresponding to multiple placeholders based on the fourth resource description sample information. The second determination module is used to determine the value of the second loss function based on the similarity between the predicted fragment and the information fragment; The second training module is used to adjust the model parameters of the initial information extraction large model when the second loss function value is greater than the second preset threshold, and return to execute the prediction of multiple placeholders based on the third resource description sample information until the second loss function value is less than or equal to the second preset threshold, thus obtaining the first information extraction large model.
[0071] In some embodiments, the fourth resource description sample information includes multiple pieces of resource-related data, and each piece of resource-related data contains n placeholders, where n is a positive integer greater than 1. Based on this, the prediction module may specifically include: The second acquisition submodule is used to obtain the prediction order corresponding to each of the n placeholders for each piece of resource-related data; The prediction submodule is used to predict the prediction segment corresponding to the i-th placeholder for each piece of resource-related data and for the i-th placeholder, based on the resource-related data and the prediction segments corresponding to the 1st to i-1th placeholders respectively, where i is a positive integer greater than 1 and not greater than n.
[0072] In some embodiments, the third acquisition module may specifically include: The third acquisition submodule is used to acquire the original resource description sample information of the target domain. The original resource description sample information includes multiple original sample data. The processing submodule is used to process multiple original sample data into a uniform length, resulting in multiple sample data of the same length; The third determination submodule is used to determine the first resource description sample information based on multiple sample data of the same length.
[0073] In this embodiment, an initial large-scale information extraction model is pre-trained based on first resource description sample information of the target domain to obtain a first large-scale information extraction model. This allows the first large-scale information extraction model to become familiar with the form and distribution of massive data in the target domain, providing a foundational understanding for domain adaptation in subsequent information extraction. Since triple tags include entity-relation-entity triple tags and entity-attribute-attribute value triple tags, and an entity includes an entity identifier and an entity type, the target large-scale information extraction model is obtained by fine-tuning the first large-scale information extraction model based on a fine-tuned dataset including second resource description sample information and its corresponding triple tags. This transforms the previously accumulated domain knowledge into accurate triple extraction capabilities, enabling the target large-scale information extraction model to accurately extract triples from the resource description information of the target domain. Thus, by using a large-scale target information extraction model, entities, the relationships between entities, and entity attribute information are extracted from resource description information to obtain entity-relationship-entity triples and entity-attribute-attribute value triples. This enables end-to-end automated and accurate triple extraction, thereby improving the efficiency of triple extraction. Furthermore, by constructing a knowledge graph based on entity-relationship-entity triples and entity-attribute-attribute value triples, the efficiency of knowledge graph construction can be improved.
[0074] Based on the knowledge graph construction method provided in the above embodiments, this application also provides specific implementation methods for electronic devices. Figure 3 A schematic diagram of the structure of an electronic device provided in one embodiment of this application is shown.
[0075] like Figure 3 As shown, the electronic device 300 may include a processor 310 and a memory 320 storing computer program instructions.
[0076] Specifically, the processor 310 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0077] Memory 320 may include mass storage for data or instructions. For example, and not limitingly, memory 320 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where suitable, memory 320 may include removable or non-removable (or fixed) media. Where suitable, memory 320 may be internal or external to electronic device 300. In a particular embodiment, memory 320 is a non-volatile solid-state memory.
[0078] In specific embodiments, the memory 320 may be implemented as a read-only memory (ROM), random access memory (RAM), static storage device, dynamic storage device, etc. The memory 320 may store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 320 and executed by the processor 310. The processor 310 reads and executes the computer program instructions stored in the memory 320 to implement any of the knowledge graph construction methods in the above embodiments.
[0079] The processor 310 reads and executes computer program instructions stored in the memory 320 to implement any of the knowledge graph construction methods in the above embodiments.
[0080] In one example, electronic device 300 may further include communication interface 330 and bus 340. Wherein, for example... Figure 3 As shown, the processor 310, memory 320, and communication interface 330 are connected via bus 340 and communicate with each other.
[0081] The communication interface 330 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.
[0082] Bus 340 includes hardware, software, or both, that couples components of an electronic device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-E) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 340 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0083] For example, the electronic device 300 can be a mobile phone, tablet computer, laptop computer, handheld computer, in-vehicle electronic device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc.
[0084] The electronic device can execute the knowledge graph construction method in the embodiments of this application, thereby achieving Figure 1 The method for constructing the knowledge graph described herein, and the beneficial effects of the corresponding method implementations, will not be elaborated further here.
[0085] Furthermore, in conjunction with the knowledge graph construction methods in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the knowledge graph construction methods in the above embodiments. Examples of such computer-readable storage media include non-transitory computer-readable storage media, such as read-only memory (ROM).
[0086] The computer program instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the knowledge graph construction method as shown in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0087] Based on the knowledge graph construction methods described in the above embodiments, this application can provide a computer program product for implementation. When the instructions in this computer program product are executed by the processor of an electronic device, they implement any of the knowledge graph construction methods described in the above embodiments.
[0088] The computer program products of the above embodiments are used to implement the knowledge graph construction method shown in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0089] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0090] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0091] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0092] The aspects of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0093] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. A method for constructing a knowledge graph, characterized in that, include: Obtain resource description information in the target domain; The target information extraction model extracts entities, relationships between entities, and attribute information of entities from the resource description information, resulting in entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning a first information extraction model based on a fine-tuning dataset. The first information extraction model is obtained by pre-training an initial information extraction model based on first resource description sample information. The fine-tuning dataset includes second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels. The entity includes an entity identifier and an entity type. Based on the entity-relationship-entity triples and the entity-attribute-attribute value triples, a knowledge graph of the target domain is constructed.
2. The method according to claim 1, characterized in that, Before extracting entities, relationships between entities, and attribute information from the resource description information using the target information extraction model to obtain entity-relationship-entity triples and entity-attribute-attribute value triples, the method further includes: Obtain the fine-tuning dataset; The first information is used to extract a large model, and prediction triples are extracted from the second resource description sample information. The first loss function value is determined based on the similarity between the predicted triplet and the triplet label; If the first loss function value is greater than the first preset threshold, adjust the model parameters of the first information extraction model and return to the execution of the first information extraction model to extract predicted triples from the second resource description sample information until the first loss function value is less than or equal to the first preset threshold, thus obtaining the target information extraction model.
3. The method according to claim 2, characterized in that, The process of obtaining the fine-tuning dataset includes: Obtain the second resource description sample information; By extracting large models from zero-sample information, entity labels and their corresponding entity label types are extracted from the second resource description sample information; Using the zero-sample information extraction model, based on the entity tags and their corresponding entity tag types, the association relationship between the entity tags is extracted from the second resource description sample information to obtain entity tag-relationship tag-entity tag triplets, and the attribute information of the entity tags is extracted from the second resource description sample information to obtain entity tag-attribute tag-attribute value tag triplets. Based on the entity tag-relationship tag-entity tag triple and the entity tag-attribute tag-attribute value tag triple, determine the initial tag of the triple; The initial labels of the triplets are verified and corrected to obtain the triplet labels; The fine-tuning dataset is determined based on the second resource description sample information and the triplet labels.
4. The method according to claim 3, characterized in that, The method of extracting large-scale models using zero-sample information, based on entity tags and their corresponding entity tag types, extracts the association relationships between entity tags from the second resource description sample information to obtain entity tag-relationship tag-entity tag triples, and extracts attribute information of entity tags from the second resource description sample information to obtain entity tag-attribute tag-attribute value tag triples, including: By using the zero-sample information extraction model, based on the entity labels and their corresponding entity label types, the association between the entity labels is extracted from the second resource description sample information to obtain entity label-relationship label-entity label triplets, as well as the basis for generating the entity label-relationship label-entity label triplets; Using the zero-sample information extraction model, based on the entity label and its corresponding entity label type, the attribute information of the entity label is extracted from the second resource description sample information to obtain the entity label-attribute label-attribute value label triplet, and the basis for generating the entity label-attribute label-attribute value label triplet; The step of determining the fine-tuning dataset based on the second resource description sample information and the triplet labels includes: Based on the generation criteria of the entity tag-relationship tag-entity tag triplet and the generation criteria of the entity tag-attribute tag-attribute value tag triplet, the generation criteria of the triplet tags are determined; The fine-tuning dataset is determined based on the second resource description sample information, the triplet labels, and the basis for generating the triplet labels.
5. The method according to any one of claims 2-4, characterized in that, Before extracting predicted triples from the second resource description sample information using the first information extraction model, the method further includes: Obtain the first resource description sample information; Randomly select multiple information fragments from the first resource description sample information; In the first resource description sample information, the multiple information fragments are replaced with multiple mask fragments to obtain the third resource description sample information; By adding placeholders corresponding to the multiple information fragments to the third resource description sample information, a fourth resource description sample information is obtained. The large model is extracted using the initial information, and the predicted fragments corresponding to the multiple placeholders are predicted based on the fourth resource description sample information. The second loss function value is determined based on the similarity between the predicted segment and the information segment; If the value of the second loss function is greater than the second preset threshold, the model parameters of the initial information extraction large model are adjusted, and the process of predicting the prediction segments corresponding to the multiple placeholders based on the third resource description sample information is returned until the value of the second loss function is less than or equal to the second preset threshold, thus obtaining the first information extraction large model.
6. The method according to claim 5, characterized in that, The fourth resource description sample information includes multiple resource-related data points. Each resource-related data point contains n placeholders, where n is a positive integer greater than 1. The step of predicting the prediction segments corresponding to the multiple placeholders based on the fourth resource description sample information includes: For each piece of resource-related data, obtain the prediction order corresponding to each of the n placeholders; For each piece of resource-related data, for the i-th placeholder, based on the resource-related data and the prediction segments corresponding to the 1st to i-1th placeholders respectively, predict the prediction segment corresponding to the i-th placeholder, where i is a positive integer greater than 1 and not greater than n.
7. The method according to claim 5, characterized in that, The step of obtaining the first resource description sample information includes: Obtain original resource description sample information of the target domain, wherein the original resource description sample information includes multiple original sample data; The original sample data are processed to have a uniform length, resulting in multiple sample data with the same length. Based on multiple sample data of the same length, the first resource description sample information is determined.
8. A knowledge graph construction apparatus, characterized in that, The device includes: The first acquisition module is used to acquire resource description information in the target domain; The first extraction module is used to extract entities, relationships between entities, and attribute information of entities from the resource description information using a target information extraction model, thereby obtaining entity-relationship-entity triples and entity-attribute-attribute value triples. The target information extraction model is obtained by fine-tuning a first information extraction model based on a fine-tuning dataset. The first information extraction model is obtained by pre-training an initial information extraction model based on first resource description sample information. The fine-tuning dataset includes second resource description sample information and its corresponding triple labels. The triple labels include entity-relationship-entity triple labels and entity-attribute-attribute value triple labels. The entity includes an entity identifier and an entity type. The construction module is used to construct a knowledge graph of the target domain based on the entity-relationship-entity triple and the entity-attribute-attribute value triple.
9. An electronic device, characterized in that, The electronic device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the knowledge graph construction method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the knowledge graph construction method as described in any one of claims 1-7.
11. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the knowledge graph construction method as described in any one of claims 1-7.