Method and device for automatically extracting and aligning triple of industrial field knowledge graph

By combining the fine-tuning technology of large and small language models and the span-based joint entity relationship extraction method, the problem of low triple extraction accuracy in text data in the industrial field is solved, the efficient construction and visual display of the knowledge graph are achieved, and the extraction efficiency is improved. accuracy and efficiency.

CN118535729APending Publication Date: 2024-08-23SHANGHAI UNIV OF ENG SCI

Patent Information

Application Number
CN202410530486.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-29
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Existing knowledge extraction models based on deep learning have high time complexity, error propagation, and bias problems in text data in the industrial field, resulting in low triplet extraction accuracy.

Method used

Adopting a combination strategy of large language model ChatGLM2-6B and small language model Bert-base-chinese, fine-tuning through Lora low-rank adapter and span-based joint entity relationship extraction method, combined with Neo4j graph database for visual display and data filtering of knowledge graphs , improve the accuracy and efficiency of triple extraction.

Benefits of technology

It improves the accuracy and efficiency of knowledge extraction and map construction, organizes information in a structured manner to facilitate analysis and application, and enhances the accuracy and consistency of triple extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535729A
    Figure CN118535729A
Patent Text Reader

Abstract

The invention relates to an industrial field knowledge graph triple automatic extraction and alignment method and device, and belongs to the technical field of natural language processing, and the method comprises the following steps: 1, obtaining text sample data, preprocessing a text sample, and making a data set; 2, putting the data set in the step 1 into a low-rank adapter method to carry out industrial field triple extraction task fine adjustment on the large language model; 3, putting the data set in the step 1 into a combined entity relation extraction method based on span to carry out industrial field triple extraction task fine adjustment on the small language model; step 4, processing an extraction result; 5, exporting a processing result as a knowledge graph and storing the knowledge graph in a common format; and step 6, carrying out visualized display of the knowledge graph through a Neo4j graph database. According to the method, the accuracy and efficiency of knowledge extraction and graph construction are improved through a large-scale language model and small-scale language model fusion strategy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and specifically relates to a method and device for automatically extracting and aligning triples of industrial knowledge graphs. Background Art

[0002] Knowledge extraction is one of the tasks in the field of natural language processing. In the context of industrial intelligence and automation, many industry information and knowledge are often scattered in various formats and sources in the form of reports, manuals and documents. The task of industrial knowledge extraction aims to automatically extract structured information from relevant text data, improve the actual use of applications such as retrieval, question answering, and data analysis, and improve enterprise information business in terms of supporting decision-making, optimizing processes, and improving efficiency.

[0003] The main methods of knowledge extraction are composed of the following four categories: rule-based knowledge extraction methods, statistics-based knowledge extraction methods, machine learning-based knowledge extraction methods, and deep learning-based knowledge extraction methods. Among them: rule-based methods rely on artificially designed predefined rules or patterns to complete information recognition and extraction tasks. When the rules are clearly defined and specific to a certain field, highly accurate results can be obtained, but it is difficult to cope with complex and changeable actual scenarios, and the scalability and flexibility are poor. Compared with rule-based methods, statistical-based methods can adapt to a wider range of data types and data patterns, and require less human intervention, but they have a high dependence on data quality and quantity, and have poor interpretability and certain opacity. Machine learning-based methods can improve the performance of the model by manually designing features. Researchers can perform targeted optimization based on domain knowledge, and the prediction results can usually be explained as a linear combination of features. The working principle of the model has strong interpretability. The disadvantage is that this method has a strong dependence on features, and its performance depends largely on the selection and design of features, which may lead to limited generalization of the model on different data sets, and it is usually difficult to handle complex data structures such as long texts.

[0004] Although deep learning-based methods can effectively and automatically extract knowledge from large amounts of unstructured data through hierarchical feature learning and complex relationship modeling, without the need to manually design features, they greatly simplify the model building process and perform well in extracting knowledge from complex data structures such as long texts. However, there are still some problems in the existing knowledge extraction models based on deep learning. For example, the binary tagging framework CASREL models the relationship as a function that maps the topic in the sentence to the object to solve the overlapping triple problem. However, since each entity relationship must be mapped and traversed, the time complexity is relatively high. For example, the joint relationship triple extraction framework PRGC decomposes the triple extraction task into three subtasks: relationship judgment, entity extraction, and subject-object alignment. It also designs a joint relationship extraction framework consisting of a potential relationship prediction component, a specific relationship sequence labeling component, and a global communication component to solve problems such as relationship judgment redundancy, poor generalization of span-based extraction, and low efficiency of subject-object alignment. However, since it is based on the Pipeline extraction mode, there are problems of error transmission and exposure bias. Errors and omissions in the entity extraction process will lead to a decrease in the accuracy of the final triple extraction. They are not well suited for knowledge extraction tasks of industrial text data. Summary of the invention

[0005] The purpose of the present invention is to address the problems existing in the prior art and provide a method for automatic extraction and alignment of triples in industrial knowledge graphs, thereby alleviating the impact of problems such as errors and omissions in the entity extraction process on the accuracy of triple extraction, and achieving better results in industrial knowledge extraction tasks.

[0006] The technical solution is as follows:

[0007] The method for automatically extracting and aligning triples of industrial knowledge graphs includes the following steps:

[0008] Step 1: Obtain text sample data, preprocess the text samples, and make a data set;

[0009] Step 2: Put the dataset in step 1 into the Lora (Low-Rank Adaptation) method to fine-tune the large language model for the industrial field triple extraction task.

[0010] Step 3: Put the dataset in step 1 into the small language model and fine-tune the triple extraction task in the industrial field by combining the span-based joint entity relationship extraction method;

[0011] Step 4: Process the results extracted in steps 2 and 3;

[0012] Step 5: Export the processing results in step 4 as a knowledge graph and store it in a common format;

[0013] Step 6: Visualize the knowledge graph through the Neo4j graph database.

[0014] Furthermore, the file preprocessing method in step 1 includes setting a sentence length threshold, measuring the sentence length, and for each sentence in the text sample data, when the sentence length exceeds the sentence length threshold, truncating the sentence according to a combination algorithm of a sentence segmentation method and a quantitative method; when the sentence length is less than the sentence length threshold, supplementing it with a specific identifier; and then using the text annotation tool doccano to perform fine-grained triple annotation on the sentences to form corpus data.

[0015] Furthermore, the large language model in step 2 is ChatGLM2-6B. The specific method of fine-tuning is to apply the decomposition of the low-rank matrix to the original pre-trained model weight matrix. Without changing the original pre-trained model parameters, an additional low-rank separable matrix is ​​added to the model as a network layer. Only the parameters of these newly added network layers are trained, and a small number of new parameters are fine-tuned for the industrial domain knowledge extraction task and saved as low-rank weights.

[0016] Furthermore, in step 3, the small language model is Bert-base-chinese, and the specific method of fine-tuning is as follows:

[0017] Step 31: Organize the dataset in step 1 into the CoNLL04 dataset format and randomly divide it into training set, test set and validation set in a ratio of 8:1:1;

[0018] Step 32: Put the input text into the Bert-base-chinese pre-trained model to obtain a text vector representation sequence;

[0019] Step 33: Detect entity types in all labeled subsequences or spans, and select entities whose entity types are not None for relationship classification;

[0020] Step 34: Filter the entity classification results, retain valid entities, and pair the entities. Use the sigmoid activation function to calculate the probability that each pair of entities belongs to a predefined relationship category, and finally obtain the relationship classification result.

[0021] Furthermore, in step 33, the entity type is detected by sampling the sequence as a subsequence through a sliding window, listing all possible text segments, combining predefined entity categories, and calculating the probability that the subsequence is a certain type of entity through a softmax activation function. This process does not consider the case where the subsequence does not constitute any of the entities.

[0022] Furthermore, the processing steps in step 4 are:

[0023] Step 41: Perform a first filtering on the results extracted from the large language model and the small language model to obtain common triplets with high consistency and mutually exclusive triplets extracted from the two models, and organize them into the form of common triplets, large language model triple extraction results, and small language model triple extraction results as data sources;

[0024] Step 42: For the data source obtained in step 41, a basic graph is generated based on the graph construction rules, and accurate triple extraction results are obtained through manual precise selection and fine-grained annotation, and the basic graph is updated in real time with entity and relationship element data;

[0025] Step 43: Filter out duplicate nodes and relationships from entity links and knowledge graphs, merge and align them to avoid redundant data and improve data quality and consistency.

[0026] The invention discloses an apparatus for automatically extracting and aligning triples of industrial knowledge graphs, comprising a data acquisition module, a data preprocessing module, a modeling and training module, an analysis module, an export storage module and a visualization display module; wherein the data acquisition module is used to acquire text data in the industrial field; the data preprocessing module is used to preprocess each sentence to form corpus data, and to prepare a standard data set with reference to the formats of the Stanford Alpaca data set and the CoNLL04 data set; the modeling and training module is used to fine-tune the ChatGLM2-6B large pre-training model in combination with the Lora technology, and to fine-tune the Bert-base-chinese small pre-training model in combination with the span-based joint entity relationship extraction technology; the analysis module is used to collect actual text data, process the actual text data using a model that focuses on optimizing the task of triple extraction in the industrial field, obtain triple extraction results, and filter and fuse the extraction results; the export storage module generates a graph from the extraction results, and selects specified triples to store in a common file format; the visualization display module stores data through the Neo4j graph database, and visualizes the knowledge graph structure, relationship and node data at the same time.

[0027] Beneficial effects:

[0028] 1) The present invention improves the accuracy and efficiency of knowledge extraction and graph construction through the fusion strategy of large language models and small language models.

[0029] 2) Organize the extracted information in a structured way and visualize the knowledge graph through the Neo4j graph database to facilitate the analysis and application of the knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a schematic diagram of the process of the present invention.

[0031] Figure 2 It is a flowchart of the method of the present invention.

[0032] Figure 3 It is a schematic diagram of the structure of the device of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. The directions or positional relationships indicated by the terms "upper", "lower", "front", "back", "left", "right", "bottom", "inside", "outside", etc. are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention:

[0034] like Figure 1 The method for automatically extracting and aligning triples of industrial knowledge graphs shown in the figure includes the following steps:

[0035] Step 1: Obtain text sample data, preprocess the text samples, and make a data set;

[0036] Step 2: Put the dataset in step 1 into the Lora (Low-Rank Adaptation) method to fine-tune the large language model for the industrial field triple extraction task.

[0037] Step 3: Put the dataset in step 1 into the small language model and fine-tune the triple extraction task in the industrial field by combining the span-based joint entity relationship extraction method;

[0038] Step 4: Process the results extracted in steps 2 and 3;

[0039] Step 5: Export the processing results in step 4 as a knowledge graph and store it in a common format;

[0040] Step 6: Visualize the knowledge graph through the Neo4j graph database.

[0041] The file preprocessing method in step 1 includes setting a sentence length threshold and measuring the sentence length. For each sentence in the text sample data, when the sentence length exceeds the sentence length threshold, the sentence is truncated according to a combination algorithm of the sentence segmentation method and the quantitative method; when the sentence length is less than the sentence length threshold, it is supplemented with a specific identifier; then the text annotation tool doccano is used to perform fine-grained triple annotation on the sentence to form corpus data.

[0042] The large language model in step 2 is ChatGLM2-6B. The specific method of fine-tuning is to apply the decomposition of the low-rank matrix to the original pre-trained model weight matrix. Without changing the original pre-trained model parameters, an additional low-rank separable matrix is ​​added to the model as a network layer. Only the parameters of these newly added network layers are trained. A small number of new parameters are fine-tuned for the industrial domain knowledge extraction task and saved as low-rank weights.

[0043] In step 3, the small language model is Bert-base-chinese. The specific method of fine-tuning is as follows:

[0044] Step 31: Organize the dataset in step 1 into the CoNLL04 dataset format and randomly divide it into training set, test set and validation set in a ratio of 8:1:1;

[0045] Step 32: Put the input text into the Bert-base-chinese pre-trained model to obtain a text vector representation sequence;

[0046] Step 33: Detect entity types in all labeled subsequences or spans, and select entities whose entity types are not None for relationship classification;

[0047] Step 34: Filter the entity classification results, retain valid entities, and pair the entities. Use the sigmoid activation function to calculate the probability that each pair of entities belongs to a predefined relationship category, and finally obtain the relationship classification result.

[0048] In step 33, the entity type is detected by sampling the sequence as a subsequence through a sliding window, listing all possible text segments, combining predefined entity categories, and calculating the probability that the subsequence is a certain type of entity through a softmax activation function. This process does not consider the case where the subsequence does not constitute any of the entities.

[0049] The processing steps in step 4 are:

[0050] Step 41: Perform a first filtering on the results extracted from the large language model and the small language model to obtain common triplets with high consistency and mutually exclusive triplets extracted from the two models, and organize them into the form of common triplets, large language model triple extraction results, and small language model triple extraction results as data sources;

[0051] Step 42: For the data source obtained in step 41, a basic graph is generated based on the graph construction rules, and accurate triple extraction results are obtained through manual precise selection and fine-grained annotation, and the basic graph is updated in real time with entity and relationship element data;

[0052] Step 43: Filter out duplicate nodes and relationships from entity links and knowledge graphs, merge and align them to avoid redundant data and improve data quality and consistency.

[0053] The invention discloses an apparatus for automatically extracting and aligning triples of industrial knowledge graphs, comprising a data acquisition module, a data preprocessing module, a modeling and training module, an analysis module, an export storage module and a visualization display module; wherein the data acquisition module is used to acquire text data in the industrial field; the data preprocessing module is used to preprocess each sentence to form corpus data, and to prepare a standard data set with reference to the formats of the Stanford Alpaca data set and the CoNLL04 data set; the modeling and training module is used to fine-tune the ChatGLM2-6B large pre-training model in combination with the Lora technology, and to fine-tune the Bert-base-chinese small pre-training model in combination with the span-based joint entity relationship extraction technology; the analysis module is used to collect actual text data, process the actual text data using a model that focuses on optimizing the task of triple extraction in the industrial field, obtain triple extraction results, and filter and fuse the extraction results; the export storage module generates a graph from the extraction results, and selects specified triples to store in a common file format; the visualization display module stores data through the Neo4j graph database, and visualizes the knowledge graph structure, relationship and node data at the same time.

[0054] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the principles and spirit of the present invention should be included in the protection scope of the present invention.

Claims

1. Methods for automatic extraction and alignment of industrial knowledge graph triples, Features: The following steps are involved: Step 1: Obtain text sample data, preprocess the text samples, and make a data set; Step 2: Put the dataset in step 1 into the low-rank adapter method to fine-tune the large language model for the industrial field triple extraction task; Step 3: Put the dataset in step 1 into the small language model and fine-tune the triple extraction task in the industrial field by combining the span-based joint entity relationship extraction method; Step 4: Process the results extracted in steps 2 and 3; Step 5: Export the processing results in step 4 as a knowledge graph and store it in a common format; Step 6: Visualize the knowledge graph through the Neo4j graph database.

2. The method for automatically extracting and aligning industrial domain knowledge graph triples as claimed in claim 1, Features: The file preprocessing method in step 1 includes setting a sentence length threshold, measuring the sentence length, and for each sentence in the text sample data, when the sentence length exceeds the sentence length threshold, truncating the sentence according to a combination algorithm of a sentence segmentation method and a quantitative method; when the sentence length is less than the sentence length threshold, supplementing it with a specific identifier; and then using the text annotation tool doccano to perform fine-grained triple annotation on the sentence to form corpus data.

3. The method for automatically extracting and aligning industrial domain knowledge graph triples as claimed in claim 1, Features: The large language model in step 2 is ChatGLM2-6B. The specific method of fine-tuning is to apply the decomposition of the low-rank matrix to the original pre-trained model weight matrix. Without changing the original pre-trained model parameters, an additional low-rank separable matrix is ​​added to the model as a network layer. Only the parameters of these newly added network layers are trained, and a small number of new parameters are fine-tuned for industrial domain knowledge extraction tasks and saved as low-rank weights.

4. The method for automatically extracting and aligning industrial domain knowledge graph triples as claimed in claim 1, Features: The small language model in step 3 is Bert-base-chinese, and the specific method of fine-tuning is as follows: Step 31: Organize the dataset in step 1 into the CoNLL04 dataset format and randomly divide it into training set, test set and validation set in a ratio of 8:1:1; Step 32: Put the input text into the Bert-base-chinese pre-trained model to obtain a text vector representation sequence; Step 33: Detect entity types in all labeled subsequences or spans, and select entities whose entity types are not None for relationship classification; Step 34: Filter the entity classification results, retain valid entities, and pair the entities. Use the sigmoid activation function to calculate the probability that each pair of entities belongs to a predefined relationship category, and finally obtain the relationship classification result.

5. The method for automatically extracting and aligning industrial domain knowledge graph triples as claimed in claim 4, Features: In step 33, the entity type is detected by sampling the sequence as a subsequence through a sliding window, listing all possible text segments, combining predefined entity categories, and calculating the probability that the subsequence is a certain type of entity through a softmax activation function. This process does not consider the case where the subsequence does not constitute any of the entities.

6. The method for automatically extracting and aligning triples of industrial domain knowledge graphs as claimed in claim 1, Features: The processing steps in step 4 are: Step 41: Perform a first filtering on the results extracted from the large language model and the small language model to obtain common triplets with high consistency and mutually exclusive triplets extracted from the two models, and organize them into the form of common triplets, large language model triple extraction results, and small language model triple extraction results as data sources; Step 42: For the data source obtained in step 41, a basic graph is generated based on the graph construction rules, and accurate triple extraction results are obtained through manual precise selection and fine-grained annotation, and the basic graph is updated in real time with entity and relationship element data; Step 43: Filter out duplicate nodes and relationships from entity links and knowledge graphs, merge and align them to avoid redundant data and improve data quality and consistency.

7. Device for automatic extraction and alignment of industrial knowledge graph triples, Features: It includes data acquisition module, data preprocessing module, modeling and training module, analysis module, export storage module and visualization display module; the data acquisition module is used to obtain text data in the industrial field; the data preprocessing module is used to preprocess each sentence to form corpus data, and make standard data sets according to the Stanford Alpaca data set and CoNLL04 data set formats; Modeling and training module: Combine low-rank adapter technology to fine-tune the ChatGLM2-6B large pre-trained model, and combine span-based joint entity relationship extraction technology to fine-tune the Bert-base-chinese small pre-trained model; the analysis module is used to collect actual text data, use a model that focuses on the optimization of triple extraction tasks in the industrial field to process actual text data, obtain triple extraction results, and filter and fuse the extraction results; The export storage module generates a graph from the extraction results and selects the specified triples to store them in a common file format; The visualization module stores data through the Neo4j graph database and visualizes the knowledge graph structure, relationships, and node data.

Citation Information

Patent Citations

  • Knowledge graph construction method and system, computer equipment and storage medium

    CN116775906A

  • Document complex knowledge object extraction method fusing knowledge graph and large language model

    CN117725222A

Cited By

  • Special equipment standard knowledge graph construction method based on large language model

    CN119202268A

  • Knowledge graph construction method and device for target culture resources and electronic equipment

    CN119539044A