Question and answer optimization method and system, electronic device, and storage medium

By breaking down problems into sub-problems in low-resource environments and optimizing queries using a pre-defined graph structure database and a knowledge graph database, the slow reasoning speed and unstable query of large language models in low-resource environments are solved, thereby improving the response speed and accuracy of the question-answering system.

CN120973891BActive Publication Date: 2026-07-07AEROSPACE INFORMATION RES INST CAS

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AEROSPACE INFORMATION RES INST CAS
Filing Date
2025-07-10
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In low-resource scenarios, existing question-answering systems that combine large language models with graph databases suffer from slow inference speed, unstable query generation, redundant schema information, excessive query results, and a lack of backup query strategies under limited computing resources, leading to a decline in answer quality.

Method used

By breaking down the target problem into multiple sub-problems for structured information extraction, matching the target entity set with a pre-defined graph structure description database and a knowledge graph database, constructing graph structure query statements, optimizing query results through caching and fallback semantic matching, and introducing Top-K constraints and field type information to optimize the returned query results.

Benefits of technology

It improves the response speed and accuracy of question-answering systems in low-resource environments, reduces computational latency and irrelevant data interference, and enhances the robustness of the system and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973891B_ABST
    Figure CN120973891B_ABST
Patent Text Reader

Abstract

The application provides a question and answer optimization method and system, electronic equipment and storage medium, and relates to the technical field of artificial intelligence. The method comprises the following steps: obtaining a plurality of sub-questions corresponding to a target question, and performing structured information extraction processing on each sub-question to obtain a target entity set corresponding to the target question; according to the target entity set, matching corresponding target graph structure description content from a pre-set graph structure description database or a knowledge graph database; determining a target prompt example from a pre-set prompt example set according to the similarity between the target question and the prompt example, and constructing a corresponding graph structure query statement according to the target prompt example and the target graph structure description content; inputting the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model. The application effectively optimizes the question and answer performance in a low-resource scenario.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a question-answering optimization method, system, electronic device, and storage medium. Background Technology

[0002] In the exploration of artificial intelligence technology applications, there are already some question-answering systems and development frameworks that integrate Large Language Models (LLMs) with graph databases. On the one hand, they fully leverage the outstanding advantages of LLMs in the field of natural language processing to accurately parse the natural language questions posed by users; on the other hand, they utilize the precise structured knowledge retrieval capabilities of graph databases corresponding to Knowledge Graphs (KGs) to quickly locate relevant factual information, thereby providing users with high-quality answers.

[0003] However, in low-resource scenarios, when attempting to deploy an LLM on local hardware, the model inference process becomes extremely slow due to limited computing resources. Faced with various questions posed by users in real time, it becomes difficult to complete calculations and provide responses quickly. Furthermore, to adapt to the hardware's computing power limits, LLMs typically require model compression. The compressed LLM, when generating query statements, exhibits lower stability and accuracy, thus impacting the overall performance and reliability of the question-answering system.

[0004] Therefore, there is an urgent need for a question-answering optimization method, system, electronic device, and storage medium to solve the above problems. Summary of the Invention

[0005] To address the problems existing in the prior art, the present invention provides a question-answering optimization method, system, electronic device, and storage medium.

[0006] This invention provides a question-answering optimization method, comprising:

[0007] Multiple sub-problems corresponding to the target problem are obtained, and structured information extraction processing is performed on each of the sub-problems to obtain a set of target entities corresponding to the target problem;

[0008] Based on the target entity set, the corresponding target graph structure description content is obtained by matching from a preset graph structure description database or a knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database;

[0009] Based on the similarity between the target question and the suggested example, a target suggested example is determined from a preset suggested example set, and a corresponding graph structure query statement is constructed based on the target suggested example and the target graph structure description content;

[0010] The query execution result corresponding to the graph structure query statement is input into the large language model to obtain the answer result corresponding to the target question output by the large language model.

[0011] According to a question-answering optimization method provided by the present invention, the method further includes:

[0012] Determine the field type information corresponding to the answer result output by the large language model;

[0013] Based on the graph structure query statement and the field type information, the query execution result corresponding to the field type information is obtained from the knowledge graph database.

[0014] According to a question-answering optimization method provided by the present invention, the method further includes:

[0015] If the target question is determined to be a historical query question, the query execution result corresponding to the graph structure query statement is obtained from the local cache space through the large language model. The local cache space is used to store historical graph structure query statements and historical query execution results corresponding to the historical query questions whose repeated question-and-answer times meet a preset threshold.

[0016] If the query execution result corresponding to the target question obtained from the knowledge graph database through the large language model is inconsistent with the query execution result obtained from the local cache space, then the query execution result in the local cache space is updated.

[0017] The method further includes:

[0018] If the large language model fails to generate a query execution result corresponding to the graph structure query statement based on the graph structure query statement, it performs semantic similarity matching with entities or relations in the knowledge graph database based on the semantic vector representation of the target question to obtain a backup entity set. The large language model then constructs a new graph structure query statement based on the backup entity set and outputs a new query execution result.

[0019] According to a question-answering optimization method provided by the present invention, obtaining multiple sub-questions corresponding to a target question includes:

[0020] Based on the hardware information of the question-answering system, the preset constraint field length is obtained, wherein the preset constraint field length is used to determine the maximum field length of each sub-question;

[0021] Based on the preset constraint field length, the target problem is decomposed to obtain multiple sub-problems corresponding to the target problem.

[0022] According to a question-answering optimization method provided by the present invention, the step of matching the corresponding target graph structure description content from a preset graph structure description database or knowledge graph database based on the target entity set includes:

[0023] Based on the mapping relationship between entities and graph structure description content, the target entity set is matched with the preset graph structure description database. If the target entity set and the preset graph structure description database are successfully matched, the target graph structure description content is obtained.

[0024] If the target entity set fails to match the preset graph structure description database, the target entity set is matched with the knowledge graph database to obtain the target graph structure description content.

[0025] According to a question-answering optimization method provided by the present invention, the step of matching the target entity set with the knowledge graph database to obtain the target graph structure description content includes:

[0026] Based on the matching results between the target entity set and the knowledge graph database, the original graph structure description content is obtained from the knowledge graph database;

[0027] Based on a preset objective function, the original graph structure description content is subjected to redundant information compression processing to obtain the target graph structure description content. The preset objective function is constructed based on the difference between the first mutual information and the second mutual information. The first mutual information is the mutual information between the original graph structure description content and the original graph structure description content after redundant information compression processing, and the second mutual information is the mutual information between the original graph structure description content after redundant information compression processing and the target problem.

[0028] According to a question-answering optimization method provided by the present invention, the step of inputting the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model includes:

[0029] The target question, the graph structure query statement, and the query execution result corresponding to the graph structure query statement are input into the large language model to obtain the answer result corresponding to the target question output by the large language model.

[0030] The present invention also provides a question-answering optimization system, comprising:

[0031] The problem input module is used to obtain multiple sub-problems corresponding to the target problem, and to perform structured information extraction processing on each of the sub-problems to obtain the target entity set corresponding to the target problem;

[0032] The graph structure description data filtering module is used to match the corresponding target graph structure description content from a preset graph structure description database or a knowledge graph database according to the target entity set. The preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database.

[0033] The query statement generation module is used to determine the target prompt example from a preset prompt example set based on the similarity between the target question and the prompt example, and to construct the corresponding graph structure query statement based on the target prompt example and the target graph structure description content.

[0034] The answer generation module is used to input the query execution result corresponding to the graph structure query statement into the large language model to obtain the answer result corresponding to the target question output by the large language model.

[0035] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the question-answering optimization method as described above.

[0036] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the question-answering optimization method as described above.

[0037] The question-answering optimization method, system, electronic device, and storage medium provided by this invention extract structured information from multiple sub-questions decomposed from the target question to obtain a set of target entities corresponding to the target question. Next, using a pre-constructed preset graph structure description database or knowledge graph database, the corresponding target graph structure description content is matched based on the target entity set. Then, by calculating the similarity between the target question and each example in the preset hint example set, a target hint example is selected, and a graph structure query statement is constructed by combining the target hint example and the target graph structure description content. Finally, the query statement is executed to obtain the query results, which are then input into a large language model to output an accurate answer to the target question, effectively optimizing question-answering performance in low-resource scenarios. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0039] Figure 1 A flowchart illustrating the question-answering optimization method provided by this invention;

[0040] Figure 2 This is a schematic diagram of the question-answering optimization system provided by the present invention;

[0041] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0043] Large language models, through pre-training on massive amounts of text, acquire powerful natural language understanding and generation capabilities, enabling them to directly handle open-domain natural language questions and generate coherent answers. However, the inherent factual biases of large language models (relying on parameters to memorize knowledge, which can easily lead to factual errors or "illusions"), the lag in knowledge updates (static parameters struggle to dynamically absorb new knowledge), and the lack of interpretability in the reasoning process (the generation process lacks explicit logical chains) greatly limit their application in rigorous professional scenarios, such as medicine, law, and scientific research.

[0044] Knowledge graphs store entities and relationships in a structured data format, possessing accurate semantic retrieval capabilities (based on factual representations of triples) and high interpretability. However, they suffer from difficulties in natural language interaction and limitations in understanding complex semantics, requiring users to be proficient in specialized graph structure query statements, such as Cypher or SPARQL.

[0045] Currently, some systems and frameworks combine large language models with graph databases for question answering. The large language model handles natural language understanding and generation (user question parsing and answer text organization); the knowledge graph provides structured knowledge support (accurate fact retrieval and logical reasoning support). Through complementary capabilities, the natural language processing advantages of the large language model are combined with the accurate structured knowledge retrieval of the knowledge graph. For example, the large language model can be used to convert the user's natural language question into a query language statement for the graph database (such as the Cypher query used by Neo4j), and then the query can be executed in the graph database to retrieve the answer. The knowledge graph stores structured entity information in the form of nodes and relationships, providing a precise knowledge retrieval foundation for question answering.

[0046] However, in low-resource scenarios, hardware constraints have a direct impact on large language models. This is specifically reflected in the following aspects:

[0047] 1. Slow model inference and unstable query generation under low computing power: Running a locally deployed large language model in an environment with limited computing resources will result in very slow inference speed, making it difficult to respond to user questions in a timely manner; at the same time, because the large language model is compressed to adapt to hardware limitations, the stability and accuracy of the generated query results decrease, and Cypher queries are prone to being incorrect or not in line with expectations.

[0048] Second, excessively long schema descriptions in knowledge graphs can lead to query generation errors: Existing graph database schemas typically contain numerous node categories, relationship types, and attribute descriptions. If the complete schema information is provided directly in the prompt, the large language model will have to process an enormous amount of context, making it difficult to grasp the parts relevant to the current problem. This often results in missing necessary conditions or generating grammatically incorrect Cypher queries, thus reducing query accuracy.

[0049] Third, excessive query data negatively impacts answer quality: Existing methods often fail to effectively filter query results from graph databases, directly providing large amounts of data to large language models for answer generation. However, excessive irrelevant or redundant data increases the processing burden on large language models, interfering with their extraction of key information. This can lead to final answers containing irrelevant content or lacking focus, thus affecting the quality of the response.

[0050] Fourth, lack of optimized backup query strategy: When the Cypher query generated by the large language model fails to retrieve valid results in the graph database, the existing solution usually lacks an intelligent backup mechanism. That is, when the direct query fails, there is no strategy for further attempts. It often can only return "no answer found" or generate an incorrect answer, which reduces the robustness and user satisfaction of the question answering system.

[0051] Therefore, it can be seen that the current large language model combined with graph data question answering method in low-resource scenarios has the following problems: On the model side, in order to adapt to local deployment, the large language model needs to be compressed through quantization (such as 4-bit) and pruning, which leads to a decrease in semantic understanding ability and an increase in the error rate of generated Cypher statements; On the data side, industrial-grade knowledge graphs contain tens of thousands of entity types, and the complete graph structure description content (such as schema text) far exceeds the context window of the large language model, resulting in key nodes or relationships not being included in the prompts, and the generated queries lacking necessary constraints; On the process side, unoptimized queries may return massive amounts of irrelevant data, and the large language model has difficulty extracting key information from redundant data under low resource conditions, which may lead to answers mixed with irrelevant content and reduced answer quality; On the system side, there is a lack of backup query strategies when queries fail.

[0052] To address the problems existing in the prior art, this invention provides an efficient question-answering method based on a large language model and graph database, suitable for low-resource environments (e.g., a single GPU, a 30B parameter 4-bit quantization model). This method addresses the problems of slow inference speed, inaccurate query generation, redundant schema information, excessive returned data, and lack of backup strategies after query failures in traditional question-answering systems in low-computing-power scenarios. It adopts a series of optimization measures, from parsing user questions, preprocessing graph schemas, generating and optimizing query statements, pruning and interpreting query results, to generating the final answer, forming an end-to-end question-answering process.

[0053] Figure 1 This is a flowchart illustrating the question-answering optimization method provided by the present invention, as shown below. Figure 1 As shown, the present invention provides a question-answering optimization method, including:

[0054] Step 101: Obtain multiple sub-problems corresponding to the target problem, and perform structured information extraction processing on each sub-problem to obtain the target entity set corresponding to the target problem.

[0055] In real-world question-answering scenarios, user-posed questions are often broad and complex. Directly passing the entire question to a large language model can easily lead to inaccurate understanding due to excessively long context or semantic ambiguity. To more accurately understand and answer the target question, it needs to be broken down into multiple sub-questions. In this invention, breaking down complex questions into smaller, more specific sub-questions helps to delve deeper into various aspects of the question, clarify the key information points that need to be obtained, and thus lay the foundation for subsequent accurate processing and answer generation.

[0056] In this invention, Chain of Thought (CoT) reasoning technology is used to decompose the target question by analyzing its semantic structure, keywords, and grammatical components. Optionally, in one embodiment, corresponding prompt words can be constructed based on Chain of Thought reasoning technology, and then the target question can be input into a large language model for question decomposition.

[0057] Furthermore, after decomposing the sub-problems, structured information extraction is required for each sub-problem. Structured information extraction refers to extracting key information from unstructured or semi-structured text data according to predefined rules or patterns and representing it in a structured form. In this invention, entities, attributes, and relationships are extracted from the sub-problems so that this information can be used more efficiently for subsequent querying, reasoning, and answer generation. Entities are typically objects with independent meaning and clear distinguishability, such as names of people, places, organizations, and products. For the identified entities, their relevant attribute information is extracted; for example, for the entity "mobile phone," attributes such as "release time," "performance parameters," and "market sales" can be extracted. Various relationships between entities are determined, such as "belongs to," "contains," and "improves."

[0058] Furthermore, by performing structured information extraction on each sub-problem, the entities extracted from all sub-problems are integrated and deduplicated, ultimately forming a target entity set corresponding to the target problem. This target entity set clarifies the key objects to focus on during knowledge retrieval, helping to narrow the search scope and improve retrieval efficiency and accuracy.

[0059] Step 102: Based on the target entity set, match the corresponding target graph structure description content from the preset graph structure description database or knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database.

[0060] In this invention, the preset graph structure description database is a pre-built database specifically for storing graph structure descriptions. Its construction is based on the mapping relationship between entities and graph structure descriptions in the knowledge graph database. This mapping relationship clearly defines the graph structure description content corresponding to each entity in the knowledge graph. Through this database, graph structure description content related to a specific entity can be found quickly and accurately.

[0061] A knowledge graph database is a database that stores knowledge in a graph structure. It uses various entities in the real world (such as people, places, events, concepts, etc.) as nodes and the relationships between entities as edges, forming a huge and complex knowledge network.

[0062] In this invention, after obtaining the target entity set, the entities in the target entity set are first compared with entities in a preset graph structure description database, such as the entity's name, identifier, and some attributes, to determine whether there is an entity in the preset graph structure description database that highly matches an entity in the target entity set. If a matching entity is found, the target graph structure description content corresponding to that entity is quickly extracted from the preset graph structure description database according to a preset mapping relationship. This content has been preprocessed and stored in a structured form that is easy to process later. In this invention, the graph structure description content is described as Schema text.

[0063] Because the pre-defined graph structure description database has been specially optimized to store commonly used and representative entities and their graph structure descriptions, the query speed is faster, which can more efficiently meet the knowledge needs of common problems, reduce system response time, and improve user experience.

[0064] Furthermore, if no matching entity from the target entity set is found in the preset graph structure description database, a secondary query is performed using the knowledge graph database. In this invention, knowledge graph search algorithms, such as path-based search and subgraph-based search, are used to search for nodes and edges related to the target entity in the knowledge graph database. Simultaneously, other information from the target entity set, such as entity attributes and contextual relationships, is combined to further narrow the search scope and improve matching accuracy. Once a matching entity is found in the knowledge graph database, starting from that entity, various related information is collected along the edges in the graph to construct the target graph structure description. This target graph structure description may be more comprehensive and detailed than the content in the preset graph structure description database, but the acquisition process is relatively more complex and time-consuming. In this invention, the knowledge graph database contains almost all possible knowledge information. Although the query efficiency is relatively low, it ensures that accurate target graph structure descriptions can still be obtained when the preset graph structure description database cannot meet the requirements, thereby guaranteeing a complete solution to the target problem.

[0065] This invention prioritizes matching a preset graph structure description database, and only matches a knowledge graph database if that fails. This process fully leverages the advantages of both databases. The preset graph structure description database can quickly handle common questions and improve query efficiency, while the knowledge graph database serves as a powerful knowledge support, ensuring accurate knowledge can still be obtained in complex or special situations. Together, they provide strong support for building an efficient and accurate intelligent question-answering system.

[0066] Step 103: Based on the similarity between the target question and the hint example, determine the target hint example from the preset hint example set, and construct the corresponding graph structure query statement based on the target hint example and the target graph structure description content.

[0067] The filtered schema information, i.e. the target graph structure description, is obtained through the above embodiments. At this time, the question-answering system enters the query statement generation stage. This invention uses graph structure query statements as Cypher language for explanation.

[0068] Traditional methods directly use a large number of examples to guide large language models in generating query statements. In low-resource environments, the excessive number of examples often leads to excessively long prompts, resulting in overly large prompts. Furthermore, large language models with a small number of parameters lack the ability to process context, leading to unstable Cypher query statements.

[0069] In this invention, pre-constructed prompt examples are first converted into vector embeddings, and a retrieval index is established. Then, relevant examples are initially screened based on the filtered schema information. Next, the user question (i.e., the target question) is vectorized, and by calculating similarity, the Top K prompt examples most relevant to the target question are retrieved from multiple prompt examples and provided to the large language model. This enables the large language model to accurately reflect the key intent of the question when generating Cypher queries, significantly improving the correctness and matching degree of the query. The process of selecting prompt examples can be represented as follows:

[0070] ;

[0071] in, This is a collection of suggested examples obtained by filtering the schema. To provide hints about the vector embeddings of the example set, Vector embedding for the user question (i.e., the target question), For the final retrieved Example of a prompt (i.e., a target prompt example).

[0072] Specifically, in this invention, for knowledge graph-based intelligent question answering or query scenarios, the user's target question needs to be transformed into a graph-structured query statement (such as a Cypher query statement) that the computer can understand, in order to accurately obtain the answer from the knowledge graph. Existing methods, in low-resource environments, directly use a large number of examples to guide the large language model in generating query statements. This leads to problems such as excessively long and large prompts due to too many examples, while the small-parameter large language model lacks the ability to handle context, resulting in unstable generated Cypher query statements. This invention pre-converts each example in a preset prompt example set into a vector embedding form. This process can be achieved through word vector models (such as Word2Vec, GloVe, etc.) or deep learning models (such as BERT, etc.).

[0073] Then, all example vectors are embedded and stored, and a retrieval index is built. The index can be built using algorithms such as Approximate Nearest Neighbor Search (ANNS), which can quickly find the vector most similar to the target vector among a large number of vectors, thus improving the efficiency of subsequent retrieval.

[0074] Furthermore, after the user poses a target question, the same model used for example vectorization is applied to the target question. Next, the similarity between the vector embedding of the user's question and the vector embedding of each example in the preset hint example set is calculated. In this invention, similarity can be calculated using cosine similarity.

[0075] In this invention, target hint examples retrieved through similarity are used to construct graph structure query statements. The invention fills the corresponding positions in the target hint examples with information from the target graph structure description, obtaining a preliminary query statement framework. Then, based on the query language used by the knowledge graph (e.g., Cypher for Neo4j graph database, SPARQL for RDF format knowledge graphs), the filled query statement framework is converted into a graph structure query statement that conforms to the syntax rules.

[0076] Step 104: Input the query execution result corresponding to the graph structure query statement into the large language model to obtain the answer result corresponding to the target question output by the large language model.

[0077] In this invention, through the steps of the above embodiments, the target question is transformed into a graph-structured query statement (such as a Cypher statement for the Neo4j graph database), and relevant data results are obtained from the knowledge graph using this query statement. Then, through a large language model, these structured query execution results are converted into natural language forms and answer results that meet the user's expectations, thereby improving the user experience and usability of the question-answering system.

[0078] The question-answering optimization method provided by this invention extracts structured information from multiple sub-questions decomposed from the target question to obtain a set of target entities corresponding to the target question. Next, using a pre-constructed preset graph structure description database or knowledge graph database, the corresponding target graph structure description content is matched based on the target entity set. Then, by calculating the similarity between the target question and each example in the preset hint example set, a target hint example is selected, and a graph structure query statement is constructed by combining the target hint example and the target graph structure description content. Finally, the query statement is executed to obtain the query results, which are then input into a large language model to output an accurate answer to the target question, effectively optimizing question-answering performance in low-resource scenarios.

[0079] Based on the above embodiments, the method further includes:

[0080] Determine the field type information corresponding to the answer result output by the large language model;

[0081] Based on the graph structure query statement and the field type information, the query execution result corresponding to the field type information is obtained from the knowledge graph database.

[0082] After generating the graph structure query statement (such as a Cypher query statement), the graph structure query statement is submitted to the knowledge graph database for execution. To avoid interference with subsequent answer generation of the large language model due to excessive returned data, this invention further introduces a Top-K constraint mechanism into the graph structure query statement, and explicitly requires that specific fields required by the question be returned based on the field type information corresponding to the answer result. For example, if the target question only requires knowing a person's name, the query only returns the name field, not all attributes of the person node.

[0083] This invention limits the size and dimensions of the result set, making the content passed to the large language model more concise. This helps the large language model focus on key evidence to generate answers. On the one hand, it reduces the overhead of the large language model in processing irrelevant data; on the other hand, it reduces the risk of confusion or exceeding the context length caused by a large influx of results, thereby improving the accuracy and efficiency of question answering. It not only reduces unnecessary data transmission but also makes query results easier to understand and process, thus improving the response speed and answer accuracy of the entire question answering process. In this invention, the process of returning query execution results for specific fields can be represented as:

[0084] ;

[0085] in, This is the generated Cypher query statement, i.e., the graph structure query statement; The optimized result set is the query execution structure obtained based on the graph structure query statement and field type information; This refers to field type information.

[0086] Based on the above embodiments, the method further includes:

[0087] If the target question is determined to be a historical query question, the query execution result corresponding to the graph structure query statement is obtained from the local cache space through the large language model. The local cache space is used to store historical graph structure query statements and historical query execution results corresponding to the historical query questions whose repeated question-and-answer times meet a preset threshold.

[0088] If the query execution result corresponding to the target question obtained from the knowledge graph database through the large language model is inconsistent with the query execution result obtained from the local cache space, then the query execution result in the local cache space is updated.

[0089] The method further includes:

[0090] If the large language model fails to generate a query execution result corresponding to the graph structure query statement based on the graph structure query statement, it performs semantic similarity matching with entities or relations in the knowledge graph database based on the semantic vector representation of the target question to obtain a backup entity set. The large language model then constructs a new graph structure query statement based on the backup entity set and outputs a new query execution result.

[0091] This invention provides a cache-aware reasoning mechanism. Specifically, upon obtaining a target question, it first determines whether the target question belongs to a historical query question. A historical query question refers to a question that has been raised and processed by other users within a certain period of time. This can be determined by comparing the recorded question text, question characteristics (such as keywords, question structure, etc.), or hash encoding the question with historical query question records stored in the local cache space.

[0092] Furthermore, if the target question is determined to be a historical query question, the graph structure query statement corresponding to the target question and its query execution result are obtained from the local cache space through the large language model. In this invention, the local cache space is a region specifically used to store data related to historical query questions whose repeated question-and-answer counts meet a preset threshold. The preset threshold can be set according to actual needs and resource conditions, for example, set to 5 times, that is, when a question is asked repeatedly 5 times or more, the question, its corresponding query statement, and the query execution result will be stored in the local cache space.

[0093] In this invention, data in the local cache space is stored in key-value pairs. The key can be a unique identifier for the question (such as the question's hash value), and the value is the corresponding graph structure query statement and query execution result. When the query execution result is needed, the large language model searches the local cache space based on the unique identifier of the target question and returns the corresponding query execution result. This method of directly retrieving results from the local cache avoids performing real-time queries on the knowledge graph database again, greatly reducing query latency and improving the system's response speed.

[0094] In some cases, query execution results for a target question may be retrieved simultaneously from both a knowledge graph database and a local cache. For example, to ensure the accuracy of cached data, the data in the cache is periodically verified. When a discrepancy is found between the query execution results retrieved from the knowledge graph database and those retrieved from the local cache, the query execution results in the local cache need to be updated. In this invention, there may be many reasons for inconsistent query execution results. For example, the data in the knowledge graph database may have been updated (e.g., new information was added, existing data was modified), while the data in the local cache has not been synchronized in time. In this case, the latest query execution result retrieved from the knowledge graph database is used as the standard, and the corresponding query execution result in the local cache is updated accordingly. The update operation can directly overwrite the original data or employ a more complex update strategy, such as incremental updates (updating only the changed data), to reduce data transfer volume and update overhead. This dynamic update mechanism ensures that the data in the local cache remains consistent with the data in the knowledge graph database, improving the reliability and effectiveness of the cached data.

[0095] This invention utilizes a cache-aware reasoning mechanism to establish a local cache for high-frequency query problems. This allows large language models to prioritize reading high-frequency results from the cache while asynchronously updating the retrieval results in the knowledge graph database. This significantly reduces the query latency of the knowledge graph database and further improves the overall system response speed. The cache-aware reasoning mechanism can be represented as follows:

[0096] ;

[0097] in, Indicates the user's query question The returned cached result This means first checking if the issue exists in the local cache. If the cached result is hit, the existing answer or query result will be returned directly. This means that if a cache miss occurs, the system asynchronously sends a real-time query to the knowledge graph (KG), i.e., KG( And update the local cache with the retrieved new data.

[0098] The large language model generates a corresponding graph-structured query statement based on the target question and attempts to retrieve the query execution result from the knowledge graph database. However, in some cases, due to factors such as the way the question is phrased, the storage format of the data in the knowledge graph, or the way the query statement is constructed, it may not be possible to directly obtain a valid query execution result. For example, the user's question may use a vague or non-standard expression, causing the generated query statement to fail to accurately match the data in the knowledge graph; or the data structure in the knowledge graph may be too complex, and the current query statement may not cover all possible situations. Therefore, in this invention, a certain judgment mechanism can be used to determine whether the large language model has successfully generated a query execution result. For example, the execution status of the query statement can be checked (e.g., whether an error message was returned, whether the returned result is empty, etc.), or the validity of the returned result can be verified (e.g., whether the result meets the expectation of the question, whether it contains the necessary information, etc.). If the judgment result indicates that no valid query execution result has been generated, a backup semantic matching mechanism is activated, the specific process of which is as follows:

[0099] In this invention, the target question is first semantically vectorized, converting each word or the entire question text into a fixed-dimensional vector reflecting its semantic features. After obtaining the semantic vector of the target question, its similarity is calculated between this vector and the semantic vectors of entities or relations in a knowledge graph database. Similarity calculation methods can include cosine similarity, Euclidean distance, etc. By calculating the similarity between the semantic vector of the target question and the vectors of each entity or relation in the knowledge graph, a similarity score is obtained.

[0100] Furthermore, based on the similarity score, entities or relationships that are semantically closest to the target question are selected to form a backup entity set. The selection criteria can be set according to actual needs; for example, the top N entities or relationships with the highest similarity scores can be selected as the backup entity set. In this invention, although the entities or relationships in the backup entity set may not be directly asked in the target question, they are semantically highly relevant to the target question and contain information related to the target question.

[0101] After obtaining the backup entity set, a new graph-structured query statement is constructed based on these entities or relationships. When constructing the query statement, the specific requirements of the target problem and the characteristics of the entities or relationships in the backup entity set are considered. For example, if the target problem is to query information related to a research result, and the backup entity set contains entities such as authors and publishing journals related to that research result, then a query statement capable of retrieving this relevant information can be constructed based on the relationships between these entities in the knowledge graph. The new query statement may employ different query patterns, filtering conditions, or traversal paths to improve the accuracy and comprehensiveness of the query.

[0102] Finally, the constructed new graph structure query statement is submitted to the knowledge graph database for execution, obtaining new query execution results. Then, the large language model generates the final answer based on the new query execution results and outputs the answer to the user. This invention, through this backup semantic matching mechanism, can automatically supplement the deficiencies of the initial query. Even if there are certain differences between the wording of the question and the description stored in the graph database, it can still find relevant information through semantic matching, thereby improving the robustness and recall rate of the entire question-answering system. For example, if a user asks for the "inventor" of a scientific research achievement, but the knowledge graph may label it as "author," semantic retrieval can identify "inventor" and "author" as similar concepts, thereby finding the corresponding entity and further obtaining relevant information as the answer to return to the user.

[0103] In one embodiment, a hierarchical reasoning process can also be constructed, including: a first layer that directly generates answers to simple factual questions (the answers to which are explicit and direct, and usually have fixed and generally accepted answers in the knowledge system) using a large language model, without needing to search a knowledge graph database; and a second layer that, for questions requiring complex reasoning, triggers multi-hop retrieval of the knowledge graph and generates explanations using a large language model. Simultaneously, this invention incorporates an early-exit mechanism, meaning that if a certain step of reasoning can satisfy the answer requirements, there is no need to continue with subsequent reasoning steps, which can significantly reduce latency and improve resource utilization efficiency.

[0104] Based on the above embodiments, obtaining multiple sub-problems corresponding to the target problem includes:

[0105] Based on the hardware information of the question-answering system, the preset constraint field length is obtained, wherein the preset constraint field length is used to determine the maximum field length of each sub-question;

[0106] Based on the preset constraint field length, the target problem is decomposed to obtain multiple sub-problems corresponding to the target problem.

[0107] In this invention, the question-answering system operates in a specific hardware environment. Memory resources are one of the key factors affecting system performance and data processing capabilities. Systems with different hardware configurations have varying amounts of available memory. For example, some embedded devices or low-configuration servers may have limited memory resources, while high-performance servers have larger memory capacities. When these question-answering systems process user-input questions, hardware with weaker computing power may require longer computation time to complete complex or long-field questions, leading to increased response latency. To ensure the question-answering system provides answers within a reasonable timeframe, this invention limits the field length of the questions based on the hardware's computing power. In this invention, the preset constraint field length ensures that each sub-question is processed efficiently within the limits of computing resources, avoiding excessively long computation times or inaccurate understanding due to excessively long questions. The preset constraint field length specifies the maximum number of characters or fields that each sub-question can contain. For example, if the preset constraint field length is 100 characters, then the number of characters in each sub-question cannot exceed 100.

[0108] This invention combines thought chain reasoning technology to decompose complex problems into several sub-problems and key points, accurately extracting the key entities, attributes, and relationships involved. This process can be represented as follows:

[0109] ;

[0110] in, This refers to the original, complex problem, i.e., the target problem; The target problem is decomposed into the first... This invention decomposes problems or key points. Through this process, it can accurately extract the key entities, attributes, and relationships involved in the problem, thereby providing accurate semantic basis for subsequent processes.

[0111] Based on the above embodiments, the step of matching the corresponding target graph structure description content from a preset graph structure description database or knowledge graph database according to the target entity set includes:

[0112] Based on the mapping relationship between entities and graph structure description content, the target entity set is matched with the preset graph structure description database. If the target entity set and the preset graph structure description database are successfully matched, the target graph structure description content is obtained.

[0113] If the target entity set fails to match the preset graph structure description database, the target entity set is matched with the knowledge graph database to obtain the target graph structure description content.

[0114] In this invention, each entity in the target entity set is first compared one by one with the entities in the preset graph structure description database. When an entity in the target entity set successfully matches an entity in the preset graph structure description database, the graph structure description content corresponding to that entity is directly returned according to the pre-established mapping relationship. This graph structure description content contains information closely related to the target entity, such as entity attributes and relationships with other entities.

[0115] In this invention, if the target entity set successfully matches the preset graph structure description database, the target graph structure description content will be obtained directly. This content can be quickly used for subsequent query generation, answer reasoning, and other processes, thereby improving the response speed and processing efficiency of the question-and-answer system.

[0116] Compared to pre-defined graph structure databases, knowledge graph databases offer richer knowledge coverage and more flexible representation of relationships, enabling them to handle more complex and ambiguous problems and provide more comprehensive and in-depth information. However, due to their massive data scale, the complexity of querying and processing is also relatively high.

[0117] When the target entity set fails to match the preset graph structure description database, it is matched with the knowledge graph database. The matching process is also based on the mapping relationship between entities and graph structure descriptions, but this mapping relationship is more complex and diverse. In the knowledge graph database, the target entity needs to be searched and associated from multiple dimensions. First, based on the target entity's name, attributes, and other information, directly related nodes are found in the knowledge graph. Then, by traversing the edges in the knowledge graph, other entities and relationships indirectly related to the target entity are discovered.

[0118] When the target entity set successfully matches the knowledge graph database, the target graph structure description content is obtained. This content is richer and more comprehensive than the content returned by the preset graph structure description database, covering a wider range of knowledge domains and more complex relationships. In one embodiment, the schema matching process is used as an example. A dual schema matching mechanism is designed, including fast filtering based on key-value matching (i.e., matching the target entity set with the preset graph structure description database) and a dynamic decomposition filtering strategy based on LLM-CoT (i.e., matching the target entity set with the knowledge graph database). Its core logic can be expressed as follows:

[0119] ;

[0120] in, This is the filtered schema set, which is the set of descriptions of the target schema structure; It is the set of entities parsed from the target problem; This indicates that the schema content corresponding to the target entity set is obtained by matching the database using a preset graph structure description. This refers to a key-value matching process. This indicates that the schema content corresponding to the target entity set is obtained by matching with the knowledge graph database. .

[0121] In this invention, key-value matching is first used. If this fails, a dynamic decomposition and filtering strategy is employed. This effectively reduces redundant schema information and lowers the risk of generating incorrect queries. First, a pre-built entity-schema library (key-value library, i.e., a pre-defined graph structure description database) is used to match the parsed key entities. If entity information related to the problem is found in the pre-defined graph structure description database, the corresponding schema content is directly returned. If no match is found, a dynamic decomposition and filtering strategy is used to select the parts closely related to the current problem from the complete knowledge graph database.

[0122] This invention uses a pre-defined graph structure description database as the first-layer matching source, enabling rapid processing of common, high-frequency query needs. This avoids the performance overhead of directly querying a massive knowledge graph database. By prioritizing matching with the pre-defined graph structure description database, the target graph structure description content can be quickly obtained in most cases, significantly improving the response speed of the question-answering system. Simultaneously, using the knowledge graph database as the second-layer matching source provides the question-answering system with more comprehensive and in-depth knowledge support. When the pre-defined graph structure description database cannot meet the requirements, the knowledge graph database, through its rich relationships and complex knowledge representation capabilities, can uncover more information related to the target entity set, ensuring that the question-answering system does not miss important information due to data source limitations, thereby improving the accuracy and completeness of the answers. Furthermore, this invention, through this hierarchical matching and matching method based on the mapping relationship between entities and graph structure description content, can more accurately locate information related to the target question, reducing the possibility of generating erroneous queries due to inaccurate or incomplete information. The rigorous comparison and screening of entity and graph structure description content during the matching process also helps improve the quality and reliability of the queries.

[0123] Based on the above embodiments, the step of matching the target entity set with the knowledge graph database to obtain the target graph structure description content includes:

[0124] Based on the matching results between the target entity set and the knowledge graph database, the original graph structure description content is obtained from the knowledge graph database;

[0125] Based on a preset objective function, the original graph structure description content is subjected to redundant information compression processing to obtain the target graph structure description content. The preset objective function is constructed based on the difference between the first mutual information and the second mutual information. The first mutual information is the mutual information between the original graph structure description content and the original graph structure description content after redundant information compression processing, and the second mutual information is the mutual information between the original graph structure description content after redundant information compression processing and the target problem.

[0126] In this invention, after extracting the corresponding original graph structure description from the knowledge graph database, redundant information in the original graph structure description needs to be compressed. This process further models the dynamic decomposition and filtering strategy in the above embodiments as an information bottleneck optimization problem. Guided by user questions, it dynamically compresses the original graph structure description obtained from the knowledge graph database, ensuring that optimal semantic relevance is preserved under a limited compression rate.

[0127] Specifically, in this invention, the original graph structure description content (taking schema content as an example) is defined as follows: The compressed original graph structure description content, i.e., the target graph structure description content, is: The target problem is Based on the information bottleneck theory, this invention constructs a preset objective function for redundant information compression processing as follows:

[0128] ;

[0129] in, The first mutual information represents the mutual information between the original graph structure description and the original graph structure description after the redundant information compression process. It is used to measure the degree of information loss during schema compression. The second mutual information represents the mutual information between the original graph structure description after the redundancy information compression process and the target problem. It is used to ensure that the compressed schema remains highly relevant to the problem. This is a weighting coefficient used to balance the relationship between compression ratio and relevance. Specifically, the redundant information compression process in this invention utilizes a large language model to dynamically evaluate the relevance between the problem and the various components of the schema, thereby achieving an approximate solution to the aforementioned objective function. The specific implementation process includes:

[0130] First, large language models address the target problem. and the original graph structure description content The elements in the vector are represented by vectors to obtain the problem vector. and Schema element vector .

[0131] Then, the problem is computed using a large language model and the first... i Schema elements Correlation score between them: .

[0132] Finally, based on the relevance score, the schema elements to be retained or removed are determined, and the original graph structure description content after redundant information compression is constructed step by step. In this step, a compression threshold is set. , making , where the threshold It can be dynamically adjusted to meet the real-time compression requirements of different problem scenarios, ensuring effective and flexible solutions to information bottleneck optimization problems. For example, in some scenarios where the accuracy of the answer is extremely important, it can... The settings are set too high, retaining only elements highly relevant to the target problem; while in scenarios where comprehensive information is required but a certain degree of redundancy is permissible, the settings can be adjusted accordingly. The settings are set relatively low, retaining some less relevant elements. Through the compression process described above, the parts closely related to the current problem can be filtered out from the schema content of the knowledge graph database, thus avoiding inputting redundant information from the entire schema into the large language model. This mechanism effectively reduces the amount of information input to the large language model, thereby reducing the risk of errors in generating structured query statements (such as Cypher).

[0133] Based on the above embodiments, the step of inputting the query execution result corresponding to the graph structure query statement into the large language model to obtain the answer result corresponding to the target question output by the large language model includes:

[0134] The target question, the graph structure query statement, and the query execution result corresponding to the graph structure query statement are input into the large language model to obtain the answer result corresponding to the target question output by the large language model.

[0135] In this invention, a context enhancement strategy is employed in the answer generation stage. The original question (i.e., the target question), the generated Cypher query (i.e., the graph-structured query statement), and the query execution result are provided as joint inputs to the large language model. When generating the answer, the LLM can refer to the query logic derived from its own reasoning and perform cross-validation based on data actually retrieved from the database, thereby avoiding arbitrary guesswork (i.e., reducing illusions). The final generated natural language answer not only has factual basis but also accurately reflects the user's query needs.

[0136] In this invention, the context enhancement strategy significantly improves the accuracy and logical consistency of the answer. Compared to traditional methods that rely on a single data source to generate answers, it ensures the transparency and verifiability of the answer generation process, making the final natural language answer both factually grounded and accurately reflecting the user's query needs. When generating answers, the large language model can simultaneously refer to its own reasoned query logic and the actual factual data retrieved from the database, avoiding guesswork (reducing the illusion phenomenon). Simultaneously, by examining Cypher queries, the large language model understands its information retrieval process and verifies whether the query results meet the question's requirements before generating the answer. This context enhancement strategy ensures that the answer content matches the query results, improving the accuracy and credibility of the answer. For example, for a complex question, the large language model can confirm the correct entity relationships involved based on the provided Cypher query statement and then draw conclusions based on the returned data, reducing the possibility of broken reasoning chains or logical errors.

[0137] This invention effectively solves many shortcomings of traditional question-answering systems in low-resource environments. It not only has significant advantages in improving query accuracy, optimizing system response speed and enhancing question-answering robustness, but also further reduces resource consumption in data processing and query generation.

[0138] The question-answering optimization system provided by the present invention is described below. The question-answering optimization system described below can be referred to in correspondence with the question-answering optimization method described above.

[0139] Figure 2 This is a schematic diagram of the question-answering optimization system provided by the present invention, as shown below. Figure 2As shown, this invention provides a question-answering optimization system, including a question input module 201, a graph structure description data filtering module 202, a query statement generation module 203, and an answer generation module 204. The question input module 201 is used to obtain multiple sub-questions corresponding to a target question and perform structured information extraction processing on each sub-question to obtain a target entity set corresponding to the target question. The graph structure description data filtering module 202 is used to match the target entity set from a preset graph structure description database or a knowledge graph database to obtain corresponding target graph structure description content. The preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database. The query statement generation module 203 is used to determine a target prompt example from a preset prompt example set based on the similarity between the target question and the prompt example, and construct a corresponding graph structure query statement based on the target prompt example and the target graph structure description content. The answer generation module 204 is used to input the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model.

[0140] The question-answering optimization system provided by this invention extracts structured information from multiple sub-questions decomposed from the target question to obtain the target entity set corresponding to the target question. Then, using a pre-constructed preset graph structure description database or knowledge graph database, it matches the corresponding target graph structure description content based on the target entity set. Next, by calculating the similarity between the target question and each example in the preset hint example set, it selects a target hint example and constructs a graph structure query statement by combining the target hint example with the target graph structure description content. Finally, it executes the query statement to obtain the query results, inputs the query results into a large language model, and outputs an accurate answer to the target question, effectively optimizing question-answering performance in low-resource scenarios.

[0141] The system provided in this embodiment of the invention is used to execute the above-described method embodiments. For specific processes and details, please refer to the above embodiments, which will not be repeated here.

[0142] Figure 3 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 3As shown, the electronic device may include: a processor 301, a communications interface 302, a memory 303, and a communication bus 304, wherein the processor 301, the communications interface 302, and the memory 303 communicate with each other through the communication bus 304. The processor 301 can call logical instructions in the memory 303 to execute a question-answering optimization method. This method includes: acquiring multiple sub-questions corresponding to a target question, and performing structured information extraction processing on each sub-question to obtain a target entity set corresponding to the target question; matching the target entity set with corresponding target graph structure description content from a preset graph structure description database or a knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database; determining target prompt examples from a preset prompt example set based on the similarity between the target question and prompt examples, and constructing a corresponding graph structure query statement based on the target prompt example and the target graph structure description content; inputting the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model.

[0143] Furthermore, the logical instructions in the aforementioned memory 303 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0144] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the question-answering optimization method provided by the above methods, the method comprising: obtaining multiple sub-questions corresponding to a target question, and performing structured information extraction processing on each of the sub-questions to obtain a target entity set corresponding to the target question; matching the target entity set with corresponding target graph structure description content from a preset graph structure description database or a knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database; determining a target prompt example from a preset prompt example set based on the similarity between the target question and the prompt example, and constructing a corresponding graph structure query statement based on the target prompt example and the target graph structure description content; inputting the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model.

[0145] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the question-answering optimization method provided in the above embodiments. The method includes: obtaining multiple sub-questions corresponding to a target question, and performing structured information extraction processing on each of the sub-questions to obtain a target entity set corresponding to the target question; matching the target entity set with corresponding target graph structure description content from a preset graph structure description database or a knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database; determining a target prompt example from a preset prompt example set based on the similarity between the target question and the prompt example, and constructing a corresponding graph structure query statement based on the target prompt example and the target graph structure description content; inputting the query execution result corresponding to the graph structure query statement into a large language model to obtain the answer result corresponding to the target question output by the large language model.

[0146] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0147] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A question-answering optimization method, characterized in that, include: Multiple sub-problems corresponding to the target problem are obtained, and structured information extraction processing is performed on each of the sub-problems to obtain a set of target entities corresponding to the target problem; Based on the target entity set, the corresponding target graph structure description content is obtained by matching from a preset graph structure description database or a knowledge graph database, wherein the preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database; Based on the similarity between the target question and the suggested example, a target suggested example is determined from a preset suggested example set, and a corresponding graph structure query statement is constructed based on the target suggested example and the target graph structure description content; The query execution result corresponding to the graph structure query statement is input into the large language model to obtain the answer result corresponding to the target question output by the large language model; The step of matching the corresponding target graph structure description content from a preset graph structure description database or knowledge graph database based on the target entity set includes: Based on the mapping relationship between entities and graph structure description content, the target entity set is matched with the preset graph structure description database. If the target entity set and the preset graph structure description database are successfully matched, the target graph structure description content is obtained. If the target entity set fails to match the preset graph structure description database, the target entity set is matched with the knowledge graph database to obtain the target graph structure description content.

2. The question-answering optimization method according to claim 1, characterized in that, The method further includes: Determine the field type information corresponding to the answer result output by the large language model; Based on the graph structure query statement and the field type information, the query execution result corresponding to the field type information is obtained from the knowledge graph database.

3. The question-answering optimization method according to claim 1, characterized in that, The method further includes: If the target question is determined to be a historical query question, the query execution result corresponding to the graph structure query statement is obtained from the local cache space through the large language model. The local cache space is used to store historical graph structure query statements and historical query execution results corresponding to the historical query questions whose repeated question-and-answer times meet a preset threshold. If the query execution result corresponding to the target question obtained from the knowledge graph database through the large language model is inconsistent with the query execution result obtained from the local cache space, then the query execution result in the local cache space is updated. The method further includes: If the large language model fails to generate a query execution result corresponding to the graph structure query statement based on the graph structure query statement, it performs semantic similarity matching with entities or relations in the knowledge graph database based on the semantic vector representation of the target question to obtain a backup entity set. The large language model then constructs a new graph structure query statement based on the backup entity set and outputs a new query execution result.

4. The question-answering optimization method according to claim 1, characterized in that, The process of obtaining multiple sub-problems corresponding to the target problem includes: Based on the hardware information of the question-answering system, the preset constraint field length is obtained, wherein the preset constraint field length is used to determine the maximum field length of each sub-question; Based on the preset constraint field length, the target problem is decomposed to obtain multiple sub-problems corresponding to the target problem.

5. The question-answering optimization method according to claim 1, characterized in that, The step of matching the target entity set with the knowledge graph database to obtain the target graph structure description includes: Based on the matching results between the target entity set and the knowledge graph database, the original graph structure description content is obtained from the knowledge graph database; Based on a preset objective function, the original graph structure description content is subjected to redundant information compression processing to obtain the target graph structure description content. The preset objective function is constructed based on the difference between the first mutual information and the second mutual information. The first mutual information is the mutual information between the original graph structure description content and the original graph structure description content after redundant information compression processing, and the second mutual information is the mutual information between the original graph structure description content after redundant information compression processing and the target problem.

6. The question-answering optimization method according to any one of claims 1 to 5, characterized in that, The step of inputting the query execution result corresponding to the graph structure query statement into the large language model to obtain the answer result corresponding to the target question output by the large language model includes: The target question, the graph structure query statement, and the query execution result corresponding to the graph structure query statement are input into the large language model to obtain the answer result corresponding to the target question output by the large language model.

7. A question-answering optimization system, characterized in that, include: The problem input module is used to obtain multiple sub-problems corresponding to the target problem, and to perform structured information extraction processing on each of the sub-problems to obtain the target entity set corresponding to the target problem; The graph structure description data filtering module is used to match the corresponding target graph structure description content from a preset graph structure description database or a knowledge graph database according to the target entity set. The preset graph structure description database is constructed based on the mapping relationship between entities and graph structure description content in the knowledge graph database. The query statement generation module is used to determine the target prompt example from a preset prompt example set based on the similarity between the target question and the prompt example, and to construct the corresponding graph structure query statement based on the target prompt example and the target graph structure description content. The answer generation module is used to input the query execution result corresponding to the graph structure query statement into the large language model to obtain the answer result corresponding to the target question output by the large language model; The graph structure description data filtering module is specifically used for: Based on the mapping relationship between entities and graph structure description content, the target entity set is matched with the preset graph structure description database. If the target entity set and the preset graph structure description database are successfully matched, the target graph structure description content is obtained. If the target entity set fails to match the preset graph structure description database, the target entity set is matched with the knowledge graph database to obtain the target graph structure description content.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the question-answering optimization method as described in any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the question-answering optimization method as described in any one of claims 1 to 6.