CN-119669402-B - Intelligent question-answering method based on large language model and domain knowledge graph
Abstract
The invention discloses an intelligent question-answering method based on a large language model and a domain knowledge graph, which comprises the steps of obtaining target vertical domain data, constructing a target domain knowledge graph, determining a first large language model, determining a second large language model when a user question text is received, inputting the user question text into the first large language model and the second large language model respectively to obtain a first query result and a second query result if the user question text is determined to be related to the target domain knowledge graph, obtaining a first answer result and a second answer result according to the first query result and the second query result through the second large language model, and outputting a final answer result according to the first answer result and the second answer result through the second large language model if the first answer result is determined to be reasonable according to the second answer result. The invention can effectively improve the output efficiency and accuracy of the response result of the large language model in the aspect of knowledge question and answer in the vertical field.
Inventors
- LI MINMIN
- LI YIYAN
- YANG QI
- LIU ZE
- WEI SHILONG
- SHENG XIAOJUN
- GUO RENZHONG
Assignees
- 人工智能与数字经济广东省实验室(深圳)
Dates
- Publication Date
- 20260505
- Application Date
- 20241122
Claims (7)
- 1. The intelligent question-answering method based on the large language model and the domain knowledge graph is characterized by comprising the following steps of: Acquiring target vertical field data, constructing a preset ontology model according to the target vertical field data, and carrying out knowledge extraction processing on the preset ontology model to obtain a target field knowledge graph; Acquiring a target language corresponding to the target field knowledge graph, determining a large language model according to the target language, and performing fine tuning of supervised training on the large language model to obtain a first large language model; Fine-tuning an entity relationship based on the target domain knowledge graph to extract a large language model, so as to obtain a first large language model, wherein the first large language model is used for identifying the entity and the relationship of the domain knowledge graph from the user problem; when receiving a user questioning text, acquiring a knowledge background and an ontology model of the knowledge graph of the target field; determining a second large language model, inputting the user question text, the knowledge background and the ontology model into the second large language model, and judging whether the user question text is related to the target domain knowledge graph or not through the second large language model; If yes, inputting the user question text to the first large language model to obtain a first query result, and obtaining a second query result according to the user question text through the second large language model; Inputting the user question text to the first large language model to obtain a first query result, wherein the method specifically comprises the following steps: inputting the user question text into the first large language model to obtain entities and corresponding relations in the user question text; determining a preset template, and converting the entity and the relation into a first query statement according to the preset template; Acquiring a target domain knowledge graph corresponding graph database, and carrying out search and lookup processing in the graph database according to the first query statement to obtain a first query result; Inputting the first query result to the second large language model, and obtaining a first response result and a second response result according to the first query result and the second query result through the second large language model; And if the first response result is judged to be reasonable according to the second response result, outputting a final response result according to the first response result and the second response result through the second large language model.
- 2. The intelligent question-answering method based on the large language model and the domain knowledge graph according to claim 1, wherein the obtaining, by the second large language model, the second query result according to the user question text specifically comprises: outputting a second query sentence according to the user question text and the ontology model through the second large language model; And carrying out search and lookup processing in the graph database according to the second query statement to obtain a second query result.
- 3. The intelligent question-answering method based on a large language model and a domain knowledge graph according to claim 1, wherein the inputting the first query result into the second large language model, obtaining a first answer result and a second answer result according to the first query result and the second query result through the second large language model specifically comprises: Inputting the first query result to the second large language model, and obtaining a first response result according to the first query result and the second query result through the second large language model; And obtaining a second response result according to the first response result, the user question text, the first query result and the second query result through the second large language model.
- 4. The intelligent question-answering method based on a large language model and a domain knowledge graph according to claim 1, wherein if the first answer result is determined to be reasonable according to the second answer result, outputting a final answer result according to the first answer result and the second answer result through the second large language model, specifically comprising: Judging whether the first response result is reasonable or not according to the second response result, if so, acquiring a preset response requirement, wherein the preset response requirement comprises a response style and a detail degree of response information; Inputting the preset answer requirements and the rationality analysis process of the first answer result into the second large language model, and outputting a final answer result through the second large language model according to the preset answer requirements, the user question text, the first answer result, the second answer result and the rationality analysis process of the first answer result.
- 5. An intelligent question-answering system based on a large language model and a domain knowledge graph, wherein the intelligent question-answering system based on a large language model and a domain knowledge graph is applied to the intelligent question-answering method based on a large language model and a domain knowledge graph according to any one of claims 1 to 4, and the intelligent question-answering system based on a large language model and a domain knowledge graph comprises: the knowledge graph construction module is used for acquiring target vertical field data, constructing a target field knowledge graph according to the target vertical field data, and determining a first large language model according to the target field knowledge graph; The relevance judging module is used for determining a second large language model when receiving a user question text, and if the second large language model judges that the user question text is relevant to the target domain knowledge graph, the user question text is respectively input into the first large language model and the second large language model to obtain a first query result and a second query result; The response result generation module is used for inputting the first query result to the second large language model, and obtaining a first response result and a second response result according to the first query result and the second query result through the second large language model; And the rationality judgment generation module is used for outputting a final response result according to the first response result and the second response result through the second large language model if the first response result is judged to be rational according to the second response result.
- 6. A terminal comprising a memory, a processor and a large language model and domain knowledge graph based intelligent question-answering program stored on the memory and executable on the processor, the large language model and domain knowledge graph based intelligent question-answering program when executed by the processor implementing the steps of the large language model and domain knowledge graph based intelligent question-answering method according to any one of claims 1-3.
- 7. A computer-readable storage medium, wherein the computer-readable storage medium stores a large language model and domain knowledge graph-based intelligent question-answering program, which when executed by a processor, implements the steps of the large language model and domain knowledge graph-based intelligent question-answering method according to any one of claims 1-3.
Description
Intelligent question-answering method based on large language model and domain knowledge graph Technical Field The invention relates to the technical field of intelligent question and answer, in particular to an intelligent question and answer method, system, terminal and computer readable storage medium based on a large language model and a domain knowledge graph. Background With the development of artificial intelligence, a large language model becomes a hotspot of current general artificial intelligence. The large language model (Large Language Model, LLM) is a class of language models which are pretrained by mass data and have very large parameter quantity, can understand and generate natural language to execute various tasks, and is widely applied by the powerful natural language understanding and generating capability. However, the existing large language model is mainly good at knowledge questions and answers in the general field, and has limitation on knowledge questions and answers in the vertical field, so that the accuracy of response results output by the large language model when the knowledge questions and answers in the vertical field are oriented is low, the output efficiency is influenced, and the requirements of users cannot be met. Accordingly, the prior art is still in need of improvement and development. Disclosure of Invention The invention mainly aims to provide an intelligent question-answering method, system, terminal and computer readable storage medium based on a large language model and a domain knowledge graph, and aims to solve the problems that in the prior art, when the large language model is used for knowledge question-answering in the aspect of vertical domain, the accuracy of output response results is low, the output efficiency is low and the user requirements cannot be met. In order to achieve the above object, the present invention provides an intelligent question-answering method based on a large language model and a domain knowledge graph, which comprises the following steps: acquiring target vertical field data, constructing a target field knowledge graph according to the target vertical field data, and determining a first large language model according to the target field knowledge graph; When receiving a user question text, determining a second large language model, and if the second large language model is used for judging that the user question text is related to the target domain knowledge graph, respectively inputting the user question text into the first large language model and the second large language model to obtain a first query result and a second query result; Inputting the first query result to the second large language model, and obtaining a first response result and a second response result according to the first query result and the second query result through the second large language model; And if the first response result is judged to be reasonable according to the second response result, outputting a final response result according to the first response result and the second response result through the second large language model. Optionally, the intelligent question-answering method based on the large language model and the domain knowledge graph, wherein the acquiring the target vertical domain data, constructing a target domain knowledge graph according to the target vertical domain data, and determining a first large language model according to the target domain knowledge graph, specifically includes: Acquiring target vertical field data, constructing a preset ontology model according to the target vertical field data, and carrying out knowledge extraction processing on the preset ontology model to obtain a target field knowledge graph; And acquiring a target language corresponding to the target domain knowledge graph, determining a large language model according to the target language, and performing fine tuning of supervised training on the large language model to obtain a first large language model. Optionally, in the intelligent question-answering method based on a large language model and a domain knowledge graph, when receiving a user question text, determining a second large language model, if the user question text is determined to be related to the target domain knowledge graph by the second large language model, inputting the user question text into the first large language model and the second large language model respectively to obtain a first query result and a second query result, which specifically includes: when receiving a user questioning text, acquiring a knowledge background and an ontology model of the knowledge graph of the target field; determining a second large language model, inputting the user question text, the knowledge background and the ontology model into the second large language model, and judging whether the user question text is related to the target domain knowledge graph or not through the second large