Instrument knowledge graph construction and instrument question answering method based on ChatGPT

CN118964535BActive Publication Date: 2026-08-07TONGJI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TONGJI UNIV
Filing Date
2024-01-20
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

然而,这些管理服务平台往往是面向拥有丰富仪器知识的专业人员,在已知所需仪器的情况下,主动检索仪器,对使用者的要求较高

Benefits of technology

[0014]本发明结合ChatGPT强大的自然语言理解能力以及生成能力,提出了一种基于ChatGPT的仪器知识图谱构建与仪器问答方法,能够方便快捷地自动化构建一定质量的仪器知识图谱,节省大量的时间以及人力成本。且将ChatGPT引入仪器问答领域,使用ChatGPT生成了仪器问题数据集,解决了该领域缺少相关数据集的问题。且结合ChatGPT强大的能力,使得仪器问答中的回答更加人性化,更加符合人类语言的形式,相比基于预置模板生成的回答更为自然流畅,实现了良好的仪器问答效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964535B_ABST
    Figure CN118964535B_ABST
Patent Text Reader

Abstract

A kind of instrument knowledge graph construction and instrument question and answer method based on ChatGPT, comprising the steps of: utilizing ChatGPT, instrument knowledge graph is constructed based on instrument original data;Utilize ChatGPT to generate instrument problem, construct instrument problem data set, train Global Pointer model;Utilize the named entity recognition in the user question in the instrument question and answer of trained Global Pointer model;Link the recognized named entity with the entity in graph database by using the method based on Jaccard similarity, link the linked entity with the corresponding instrument type entity, query and obtain the associated information of the instrument type entity linked;The associated information of the instrument type entity obtained is assembled with question into prompt, and input into ChatGPT to generate answer.The present application can construct instrument knowledge graph conveniently and quickly, and realize instrument question and answer based on instrument knowledge graph, so that users can retrieve relevant instruments according to application field and scene in the case of insufficient professional knowledge, greatly reducing the use cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of knowledge graph construction and question answering technology, specifically a method for constructing an instrument knowledge graph and answering instrument questions based on ChatGPT. Background Technology

[0002] With the continuous advancement of science and technology, the types and quantities of instruments are experiencing explosive growth. Scientists, engineers, and researchers face a vast and complex field of instruments, making the accurate and efficient acquisition of relevant information a challenge. Currently, several instrument management and sharing platforms exist in the industry. However, these management service platforms are often geared towards professionals with extensive instrument knowledge, requiring them to proactively search for instruments once the necessary information is known, which places high demands on the users.

[0003] A knowledge graph describes concepts, entities, and their relationships in a structured form, expressing internet information in a way that more closely resembles human cognition. It provides a better ability to organize, manage, and understand the massive amounts of information on the internet. Essentially, a knowledge graph is a semantic network composed of nodes and edges. Nodes represent entities or concepts, and edges represent the relationships between them. Knowledge graphs can manage complex data in the form of entity-relationship triples. With the development of knowledge graph technology, it has been applied to an increasing number of vertical fields. In the field of instrumentation, knowledge graph technology can be used to systematically organize and manage basic instrument information, including name, model, application area, and functions. This helps scientists, researchers, engineers, and staff better understand the characteristics and advantages of different instruments, providing guidance for the selection of specific instruments.

[0004] In recent years, intelligent question-answering systems based on knowledge graphs have emerged and developed rapidly. These systems retrieve answers from data within knowledge graphs based on user questions. Intelligent question-answering systems based on instrument knowledge graphs allow users, even with insufficient professional knowledge, to retrieve relevant instruments based on application areas and scenarios, significantly reducing usage costs. They provide scientists, researchers, engineers, and other relevant personnel with fast and accurate instrument retrieval and question-answering services, promoting interoperability and sharing among instruments, and supporting technological progress, innovation, and practical work needs.

[0005] ChatGPT, developed by OpenAI, is a large language model with powerful natural language understanding and generation capabilities. Large language models are typically trained on massive corpora, allowing them to learn the statistical patterns of natural language. The model can then use this learned knowledge to generate new text. Based on this ability, large language models can effectively understand natural language and provide corresponding responses. Large language models can be used for various tasks, including but not limited to text generation, machine translation, and natural language question answering. Summary of the Invention

[0006] To obtain instrument-related information more accurately and efficiently, this invention provides a method for constructing an instrument knowledge graph and answering instrument questions based on ChatGPT. This method introduces ChatGPT, leveraging its powerful natural language understanding and generation capabilities to automatically construct a large-scale instrument knowledge graph of a certain quality. Simultaneously, ChatGPT is incorporated into instrument question answering, using it to construct an instrument question dataset. This dataset is then used to train a Global Pointer model for named entity recognition in instrument questions. Furthermore, ChatGPT is used to optimize the final answer during question answering, achieving good instrument question answering results.

[0007] A method for constructing an instrument knowledge graph and answering instrument questions based on ChatGPT includes the following steps:

[0008] Step S1: Using ChatGPT, construct an instrument knowledge graph based on the instrument's raw data;

[0009] Step S2: Use ChatGPT to generate a certain number of instrument questions, construct an instrument question dataset, and use the constructed dataset to train the Global Pointer model;

[0010] Step S3: Use the trained Global Pointer model to perform named entity recognition in user questions during instrument question answering;

[0011] Step S4: Based on the named entities identified by the model, the identified named entities are linked with entities in the graph database using the Jaccard similarity method. The linked entities are then linked with the corresponding instrument type entities, and further querying is performed to obtain the associated information of the linked instrument type entities.

[0012] Step S5: Assemble the associated information of the obtained instrument type entities and the question into a prompt, and input it into ChatGPT to generate the answer.

[0013] The present invention has the following advantages and beneficial effects:

[0014] This invention combines ChatGPT's powerful natural language understanding and generation capabilities to propose a ChatGPT-based method for constructing instrument knowledge graphs and answering instrument questions. This method enables convenient and rapid automated construction of high-quality instrument knowledge graphs, saving significant time and manpower costs. Furthermore, by introducing ChatGPT into the field of instrument question answering, a dataset of instrument questions is generated using ChatGPT, addressing the lack of relevant datasets in this area. Moreover, leveraging ChatGPT's powerful capabilities makes the answers in instrument question answering more human-like and consistent with human language, resulting in more natural and fluent responses compared to those generated based on pre-set templates, achieving excellent instrument question answering performance. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating the overall process of the instrument knowledge graph construction and instrument question-answering method based on ChatGPT of this invention.

[0016] Figure 2 A flowchart for constructing an instrument knowledge graph;

[0017] Figure 3 A flowchart for constructing an instrument problem dataset;

[0018] Figure 4 This is a structural diagram of the Global Pointer model in the embodiment;

[0019] Figure 5 This is a flowchart of the instrument's question and answer process. Detailed Implementation

[0020] This invention uses ChatGPT to construct a knowledge graph, and applies ChatGPT, knowledge graph, and deep learning technologies to the field of instrument question answering systems.

[0021] This invention can conveniently and quickly construct an instrument knowledge graph, and realize instrument question answering based on the constructed instrument knowledge graph. This allows users to retrieve relevant instruments according to application fields and scenarios even when they lack professional knowledge, greatly reducing the cost of use.

[0022] The technical solutions provided in this application will be further described below with reference to specific embodiments and accompanying drawings. The advantages and features of this application will become clearer from the following description.

[0023] like Figure 1 As shown, the present invention proposes an instrument knowledge graph construction and instrument question-answering method based on ChatGPT, which includes the following steps:

[0024] Step S1: Using ChatGPT, construct an instrument knowledge graph based on the instrument's raw data;

[0025] Step S2: Use ChatGPT to generate a certain number of instrument questions, construct an instrument question dataset, and use the constructed dataset to train the Global Pointer model;

[0026] Step S3: Use the trained Global Pointer model to perform named entity recognition in user questions during instrument question answering;

[0027] Step S4: Based on the named entities identified by the model, the identified named entities are linked with entities in the graph database using the Jaccard similarity method; the linked entities are then linked with the corresponding instrument type entities, and further querying is performed to obtain the associated information of the linked instrument type entities.

[0028] Step S5: Assemble the associated information of the obtained instrument type entities and the question into a prompt, and input it into ChatGPT to generate the answer.

[0029] Furthermore, in step S1, leveraging ChatGPT's powerful language understanding capabilities and combining the ontology set of the instrument knowledge graph determined by experts, as well as the relationships between the ontologies, a two-stage method is employed. ChatGPT automatically extracts the corresponding five-tuples (head entity, ontology corresponding to the head entity, relation, tail entity, ontology corresponding to the tail entity) from the raw instrument data, thereby constructing the instrument knowledge graph. This method can conveniently and quickly construct an instrument knowledge graph of a certain quality, saving significant time and manpower costs.

[0030] Furthermore, in step S2, ChatGPT's powerful language generation capabilities are utilized to generate question templates for corresponding instrument-related questions, such as "[Instrument] can be used in what fields?". The templates enclosed in "[" and "]" are "entity type placeholders," which can be filled with the entities extracted in step S1 to generate the instrument question dataset. In the Global Pointer model, ChatGPT is used to encode the vectors of the instrument questions in the dataset. Combining ChatGPT's powerful natural language generation and understanding capabilities solves the problem of insufficient relevant instrument question datasets. Using ChatGPT to encode the vectors of the instrument questions in the dataset during the training of the Global Pointer model makes the vectors more semantically accurate, thus enhancing the performance of the Global Pointer model.

[0031] Furthermore, in step S3, leveraging ChatGPT's powerful language understanding capabilities, ChatGPT is used to encode the user's questions into vectors. This aligns with the purpose of step S2, which uses ChatGPT to encode vectors of instrument questions in the dataset.

[0032] Furthermore, in step S5, the information obtained in step S4 is used to form a prompt with the user's question. Combined with ChatGPT's generation capabilities, ChatGPT is used to generate a more intelligent and human-like response. Compared to responses generated based on preset answer templates, responses generated using ChatGPT are more in line with human response patterns and can be flexibly organized according to different questions, achieving better question-and-answer results.

[0033] like Figure 2 As shown, step S1 specifically includes:

[0034] Step S1-1: Based on the instrument's raw data, experts determine the ontology set and the relationships between the ontology in the corresponding instrument knowledge graph.

[0035] Step S1-2: Assemble the portion of the original instrument data requiring quintuple (head entity, corresponding ontology, relation, tail entity, corresponding ontology) extraction with the determined ontology set and the relationships between the ontologies, forming a prompt similar to "Given original data: sentence. Given ontology set [...] and relation type list [...]. Which ontology sets and relations from the relation type list are included in this sentence?" The sentence represents the portion of the original instrument data requiring quintuple extraction, and the ontology set and relation type list are determined by the experts in Step S1-1. Input the resulting prompt into ChatGPT, and ChatGPT's responses will reveal the ontology types and relation types present in this portion of the instrument data.

[0036] Step S1-3: Using a multi-turn dialogue approach, each dialogue takes a portion of the original instrument data requiring quintuple extraction, combines it with the ontology type and relation type obtained in step S1-2, and concatenates them into a structure similar to "Given data: sentence. The types of the two entities are (ontology 1, ontology 2), and the relationship between them is: relation. Please find all such entity pairs in the given sentence." Here, "sentence" refers to the portion of the original instrument data requiring quintuple extraction, and "ontology 1," "ontology 2," and "relation" refer to the ontology type, relation type, and relation obtained in step S1-2. By combining multiple rounds of dialogue and selecting different ontology types and relation types, all existing quintuples in this portion of the instrument data can be extracted.

[0037] Step S1-4: Repeat steps S1-2 and S1-3 until all the quintuples in the raw instrument data have been extracted to form structured data.

[0038] Steps S1-5: Store the extracted structured data into the Neo4j database to construct the instrument knowledge graph, and provide it to step S4.

[0039] like Figure 3 As shown, step S2 specifically includes:

[0040] Step S2-1: Based on all entities in the knowledge graph constructed in Step S1 and the ontology set determined by experts, establish a dictionary that maps ontology types to entity word lists.

[0041] Step S2-2: Using ChatGPT, generate a certain number of instrument question templates, such as "[Instrument] can be used in what fields?" and "Why should [Instrument] be used in [Application Field]?". The "[" and "]" in the templates are "ontology type placeholders," which will be replaced with specific entity words of that ontology type in the next step S2-3.

[0042] Step S2-3: Construct the training set for the instrument question dataset. Randomly select a certain number of instrument question templates generated by ChatGPT, and replace all "ontology type placeholders" in the templates with specific entity words. Replace a certain number of entity words corresponding to the ontology type obtained in step S2-1 with each ontology type placeholder, thus obtaining the training set for the instrument question dataset. The validation set uses all instrument question templates, similarly replacing all "ontology type placeholders" in the templates with specific entity words, and replacing a certain number of entity words corresponding to the ontology type obtained in step S2-1 with each ontology type placeholder, thus obtaining the validation set for the dataset. This completes the construction of the instrument question dataset.

[0043] Step S2-4: Train the Global Pointer model using the instrument problem dataset obtained in Step S2-3. During training, use ChatGPT to encode the vectors of the instrument problems in the dataset. Figure 4 As shown, the GlobalPointer model mainly consists of three parts: a Token Embedding layer, a Span prediction layer, and a loss function calculation layer. The Token Embedding layer, represented by the green diagonal background in the diagram, uses ChatGPT to encode the input text sequence as a vector. The Span prediction layer, represented by the gray background in the diagram, primarily predicts entity segments from the sequence representation. Finally, the loss function calculation layer, represented by the white rectangle in the diagram, is used to calculate the corresponding loss function.

[0044] Step S3 specifically includes:

[0045] Step S3-1: The user enters the question they want to ask, Q1;

[0046] Step S3-2: Encode the vector of problem Q1 using ChatGPT;

[0047] Step S3-3: Use the Global Pointer model trained in step S2 to identify named entities in question Q1, obtaining named entities e1, e2...e n , where n is the number of named entities identified in question Q1.

[0048] like Figure 5 As shown, step S4 specifically includes:

[0049] Step S4-1: Based on the named entities e1, e2...e obtained in step S3 n e1, e2...e n Link entities E1, E2, ..., E in the knowledge graph using a Jaccard similarity-based method. n superior.

[0050] Step S4-2: Based on entities E1, E2...E in the knowledge graph obtained from the links... n Perform a join query on the graph database to retrieve E1, E2....E n The associated instrument type entities T1, T2....T g This is called the "key instrument". Here, 'g' refers to the number of instrument-type entities obtained from the join query. This completes the instrument linking.

[0051] Step S4-3: Based on the associated instrument type entities T1, T2...T g Further queries are performed to obtain other entities associated with each "key instrument". Based on the information of these other entities and the information of the "key instrument", detailed information of the "key instrument" is assembled according to the template.

[0052] In this invention, step S4-1 is implemented because, in real-world usage scenarios, the entities in a user's question are not entirely identical to the entities in the graph database, and there may also be typos in the user's question. Therefore, entity links are used to associate the entities in the question with the entities in the knowledge graph.

[0053] Based on the entity library existing in the knowledge graph constructed in step S1, entity links are performed on the keywords. The main method for entity linking is to calculate the Jaccard similarity between the keywords and candidate entities in the entity library, and link the entity words with the highest similarity. The Jaccard similarity calculation formula is:

[0054]

[0055] Where X and Y represent candidate entities and keywords, respectively, X∩Y represents the common character set of X and Y, X∪Y represents the character set of X and Y after merging and deduplication, and |X| represents the number of characters in X.

[0056] After calculating the Jaccard similarity for all candidate entities, the entity with the highest similarity is linked. The final number of linked entity words is the same as the number of keywords identified in the question.

[0057] Step S5 specifically includes:

[0058] Step S5-1: Based on the detailed information of all "key instruments" obtained in step S4, concatenate the detailed information of all "key instruments" and combine it with the user's question to assemble a prompt in the format "Question: {}, Instrument Information {}".

[0059] Step S5-2: Give ChatGPT the following instruction: "You are an intelligent question-and-answer robot in the field of instrumentation. Each time, I will give you a question and a piece of instrument information text, in the format of question: {...}, instrument information {...}. You need to answer the question based on the instrument information I provide, and the answer cannot omit any content from the information. If the instrument information I provide is empty, you need to answer 'I'm sorry, based on the existing instrument information, I cannot answer your question'." Combine the prompt obtained in step S5-1 with the prompt, input both into ChatGPT to obtain the answer to the user's question, completing one round of instrument question-and-answer.

[0060] The above description is merely a description of preferred embodiments of this application and is not intended to limit the scope of this application in any way. Any changes or modifications made by those skilled in the art based on the above-disclosed technical content should be considered as equivalent and valid embodiments and fall within the scope of protection of the technical solution of this application.

Claims

1. A method for constructing an instrument knowledge graph and answering instrument questions based on ChatGPT, characterized in that, Includes the following steps: Step S1: Using ChatGPT, construct an instrument knowledge graph based on the instrument's raw data; Step S2: Use ChatGPT to generate instrument questions, construct an instrument question dataset, and use the constructed dataset to train the Global Pointer model; Step S3: Use the trained Global Pointer model to perform named entity recognition in user questions during instrument question answering; Step S4: Based on the named entities identified by the model, the identified named entities are linked with entities in the graph database using the Jaccard similarity method. The linked entities are then linked with the corresponding instrument type entities, and further querying is performed to obtain the associated information of the linked instrument type entities. Step S5: Assemble the associated information of the obtained instrument type entities and the question into a prompt, and input it into ChatGPT to generate the answer; Step S1 specifically includes: Step S1-1: Based on the instrument's raw data, determine the ontology set in the corresponding instrument knowledge graph and the relationships between the ontology sets; Step S1-2: Assemble the original instrument data that needs to be extracted into a quintuple with the determined ontology set and the relationship between the ontology to form a prompt. The quintuple includes a head entity, the ontology corresponding to the head entity, a relation, a tail entity, and the ontology corresponding to the tail entity. Input the composed prompt into ChatGPT, and obtain the ontology type and relation type existing in this part of the instrument data through ChatGPT's response. Step S1-3: Using a multi-turn dialogue approach, each dialogue will combine the portion of the original instrument data that needs to be extracted into a quintuple with the ontology type and relation type obtained from step S1-2, and then concatenate them. By combining multiple rounds of dialogue, different ontology types and relation types will be selected to extract all the quintuples that exist in this portion of the instrument data. Step S1-4: Repeat steps S1-2 and S1-3 until all the quintuples in the raw instrument data have been extracted to form structured data. Steps S1-5: Store the extracted structured data into the database, construct the instrument knowledge graph, and provide it to step S4; Step S2 specifically includes: Step S2-1: Based on all entities in the knowledge graph constructed in Step S1 and the determined ontology set, establish a dictionary of ontology types to entity word lists; Step S2-2: Use ChatGPT to generate instrument question templates; Step S2-3: Use the entity words obtained in step S2-1 to fill in the question template and construct the training set of the instrument question dataset; Step S2-4: Use the instrument problem dataset obtained in step S2-3 to train the Global Pointer model. During the training process, use ChatGPT to encode the vectors of the instrument problems in the dataset.

2. The method as described in claim 1, characterized in that, Step S3 specifically includes: Step S3-1: The user enters the question they want to ask, Q1; Step S3-2: Encode the vector of problem Q1 using ChatGPT; Step S3-3: Use the Global Pointer model trained in step S2 to identify named entities in question Q1, obtaining named entities e1, e2...e n , where n is the number of named entities identified in question Q1.

3. The method as described in claim 1, characterized in that, Step S4 specifically includes: Step S4-1: Based on the named entities e1, e2...e obtained in step S3 n e1, e2...e n Link entities E1, E2...E in the knowledge graph using a Jaccard similarity-based method. n superior; Step S4-2: Based on entities E1, E2...E in the knowledge graph obtained from the links... n Perform a join query on the graph database to retrieve E1, E2....E n The associated instrument type entities T1, T2....T g This is called "key instrument", where g refers to the number of instrument-type entities obtained from the association query; Step S4-3: Based on the associated instrument type entities T1, T2...T g Further queries are performed to obtain other entities associated with each "key instrument". Based on the information of these other entities and the information of the "key instrument", detailed information of the "key instrument" is assembled according to the template.

4. The method as described in claim 3, characterized in that, Step S5 specifically includes: Step S5-1: Based on the detailed information of all "key instruments" obtained in step S4-3, concatenate the detailed information of all "key instruments" and combine it with the user's question to assemble a prompt word in the format "Question: {}, Instrument Information {}"; Step S5-2: Give instructions to ChatGPT, combine them with the prompt obtained in step S5-1, input both into ChatGPT, obtain the answer to the user's question, and complete one round of instrument question and answer.

Citation Information

Patent Citations

  • Question answering method combining sequence model and knowledge graph

    CN116127095A

  • Knowledge graph generation type question answering method and system based on large language model

    CN117033608A