CN120162425A - Question-and-answer data retrieval and large model summary method, device, equipment and medium - Google Patents
Question-and-answer data retrieval and large model summary method, device, equipment and medium Download PDFInfo
- Publication number
- CN120162425A CN120162425A CN202510372120.2A CN202510372120A CN120162425A CN 120162425 A CN120162425 A CN 120162425A CN 202510372120 A CN202510372120 A CN 202510372120A CN 120162425 A CN120162425 A CN 120162425A
- Authority
- CN
- China
- Prior art keywords
- question
- natural language
- query
- target
- knowledge base
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3329—Natural language query formulation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/335—Filtering based on additional data, e.g. user or group profiles
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Mathematical Physics (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a query and answer type data retrieval and large model summarization method, device, equipment and medium, which relate to the technical field of artificial intelligence, and are used for writing prompt words for natural language questions of users, determining target indexes corresponding to the natural language questions, generating structured query sentences, inputting the structured query sentences into a database server, executing query operation, outputting query results and natural language questions to a preset model if the query operation is successful, obtaining a first query and answer type summarization result, screening retrieval results by taking the target indexes as retrieval keywords if the query operation fails, filtering and sorting the retrieval results, obtaining target retrieval results, inputting the target retrieval results and the natural language questions to the preset model, obtaining a second query and answer type summarization result, realizing query and answer type data retrieval and large model summarization under the condition of not training and fine tuning specific scenes, reducing model deployment complexity, and improving resource utilization efficiency and accuracy of the query and answer type data retrieval and large model summarization.
Description
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a question-answer type data retrieval and large model summarization method, a question-answer type data retrieval and large model summarization device, question-answer type data retrieval equipment and large model summarization medium.
Background
In the current intelligent question-answering system, converting the natural language questions of the user into executable SQL (Structured Query Language ) is a key step for realizing data-driven answer, but in the prior art, when complex questions or questions in specific fields are processed, the problems of low accuracy rate exist, and especially errors are easy to occur in the aspects of index selection, condition construction and the like. In addition, because the data structure and the business requirement of each application scene are different, the targeted training and fine tuning of the model not only needs a large amount of computing power resources, but also can cause the generalization capability of the model to be reduced, and meanwhile, when the effective SQL cannot be generated, the system often lacks an effective spam strategy, and the user experience is influenced.
From the above, how to realize question-answer data retrieval and large model summarization without training and fine tuning for specific scenes, reduce complexity of model deployment, and improve resource utilization efficiency and accuracy of question-answer data retrieval and large model summarization are problems to be solved in the art.
Disclosure of Invention
In view of the above, the invention aims to provide a method, a device, equipment and a medium for question-answer data retrieval and large model summarization, which can realize question-answer data retrieval and large model summarization without training and fine adjustment for specific scenes, reduce complexity of model deployment and improve resource utilization efficiency and accuracy of question-answer data retrieval and large model summarization. The specific scheme is as follows:
In a first aspect, the application discloses a question-answer data retrieval and large model summarization method, which comprises the following steps:
Acquiring a natural language problem of a user, writing a prompt word for the natural language problem, determining an index range by utilizing the prompt word, and determining a target index corresponding to the natural language problem based on the index range;
Generating a structured query statement based on the natural language problem and the target index, inputting the structured query statement to a database server, and executing a query operation;
If the query operation is successful, outputting a query result to complete question-answer data retrieval, and then inputting the query result and the natural language questions into a preset model to be summarized so as to obtain a first question-answer summary result;
If the query operation fails, the target index is used as a search keyword to screen search results from a preset knowledge base, the search results are filtered and sequenced to obtain target search results so as to complete question-answer data search, and then the target search results and the natural language questions are input into the preset model to be summarized so as to obtain a second question-answer summary result.
Optionally, the writing the prompt word for the natural language question includes:
determining a prompt word writing rule based on a natural language problem of a user and introducing a domain knowledge graph;
and packaging the writing rules and writing sentences as templates, and filling and adjusting the templates by utilizing the natural language problems to generate prompt words.
Optionally, the determining the index range by using the prompt word, determining the target index corresponding to the natural language question based on the index range, includes:
Screening a target data table related to the natural language problem from a preset data table by using the prompt word;
Determining an index range from the target data table, writing a target prompt word according to the index range and the natural language problem, and determining a target index corresponding to the natural language problem by using the target prompt word.
Optionally, the generating a structured query statement based on the natural language question and the target index includes:
Writing a structured prompt word according to the natural language problem of the user, wherein the structured prompt word comprises a time rule, a region rule, a structured query sentence generation rule, a background knowledge rule, a sentence and a sentence example;
And generating one or more structured query sentences based on the natural language questions and the target indexes by using NL2SQL technology and the structured prompt words.
Optionally, if the query operation fails, the step of screening the search result from the preset knowledge base by using the target index as the search keyword includes:
if the query operation fails, starting a retry mechanism, recording the current retry times, and jumping to a flow for generating a structured query statement to generate a next structured query statement;
if the query operation corresponding to the next structured query statement fails, judging whether the current retry number is greater than a preset retry number threshold;
And if the current retry times are greater than a preset retry times threshold, screening out a search result from a preset knowledge base by taking a target index corresponding to the natural language problem as a search keyword.
Optionally, the screening the search result from the preset knowledge base by using the target index as the search keyword includes:
Acquiring special data related to each index, constructing a special knowledge base by utilizing a retrieval enhancement generation technology, and copying the special data into the special knowledge base in a one-to-one copying mode;
Acquiring summarized data related to natural language problems of all users, constructing a summarized knowledge base by utilizing a search enhancement generation technology, and copying the summarized data into the summarized knowledge base in a one-to-one copying mode;
Inputting the target index as a search keyword into the special knowledge base for searching, and outputting a search result if relevant data exist in the special knowledge base;
and if the related data does not exist in the special knowledge base, inputting the target index into the summarized knowledge base as a search keyword for searching, and if the related data exists in the summarized knowledge base, outputting a search result.
Optionally, the filtering and sorting the search result includes:
filtering the search result according to the time, place and index in the natural language problem of the user to obtain the filtered search result;
and sorting the filtered search results according to a preset sorting rule, wherein the sorting rule comprises an timeliness rule, an importance rule and a correlation rule.
In a second aspect, the application discloses a question-answer data retrieval and large model summarization device, comprising:
the index determining module is used for acquiring a natural language problem of a user, writing a prompt word for the natural language problem, determining an index range by utilizing the prompt word, and determining a target index corresponding to the natural language problem based on the index range;
The query module is used for generating a structured query statement based on the natural language problem and the target index, inputting the structured query statement to a database server and executing query operation;
The first summarization module is used for outputting a query result to complete question-answer type data retrieval if the query operation is successful, and then inputting the query result and the natural language questions into a preset model to summarize so as to obtain a first question-answer type summarization result;
and the second summarizing module is used for screening out a search result from a preset knowledge base by taking the target index as a search keyword if the query operation fails, filtering and sequencing the search result to obtain a target search result so as to complete question-answer data search, and inputting the target search result and the natural language problem into the preset model to summarize so as to obtain a second question-answer summarizing result.
In a third aspect, the present application discloses an electronic device, comprising:
A memory for storing a computer program;
And the processor is used for executing the computer program to realize the question-answer data retrieval and large model summarization method.
In a fourth aspect, the present application discloses a computer storage medium for storing a computer program, wherein the computer program when executed by a processor implements the steps of the foregoing disclosed question-answer data retrieval and large model summarization method.
The application provides a question-answer type data retrieval and big model summarization method, which comprises the steps of obtaining a natural language question of a user, compiling a prompt word for the natural language question, determining an index range by utilizing the prompt word, determining a target index corresponding to the natural language question based on the index range, generating a structured query sentence based on the natural language question and the target index, inputting the structured query sentence into a database server, executing query operation, outputting a query result to complete question-answer type data retrieval if the query operation is successful, inputting the query result and the natural language question into a preset model to summarize to obtain a first question-answer type summarization result, screening the target index from a preset knowledge base as a retrieval key word if the query operation is failed, filtering and sequencing the retrieval result to obtain a target retrieval result, and inputting the target retrieval result and the natural language question into the preset model to obtain a second question-answer type summarization result. The method and the system write the prompt word for the natural language problem of the user so as to determine the target index, generate the structured query statement based on the natural language problem and the target index, and can improve the overall accuracy of a query number scene when the problem in complex or specific fields is processed, input the structured query statement into a database server and execute query operation, if the query operation is successful, output the query result to complete question-answer type data retrieval, input the query result and the natural language problem into a preset model to be summarized so as to obtain a first question-answer type summary result, utilize the native capability of a large model without training and fine adjustment for specific scenes, reduce the cost and complexity of model deployment, if the query operation fails, screen the target index as a search keyword from a preset knowledge base, filter and sort the search result to obtain a target search result, complete question-answer type data retrieval, input the target search result and the natural language problem into the preset model to be summarized so as to obtain a second question-answer type data retrieval, reduce unnecessary consumption, improve the utilization efficiency, further improve the utilization efficiency of the user experience after the database server fails, and further improve the utilization efficiency of the question-answer type data retrieval system and the user experience.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a question-answer data retrieval and large model summarization method disclosed by the application;
FIG. 2 is a detailed flow chart of question-answer data retrieval and large model summary of the present application;
FIG. 3 is a schematic diagram of a question-answer data retrieval and large model summarizing device according to the present application;
fig. 4 is a block diagram of an electronic device according to the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the current intelligent question-answering system, the conversion of natural language questions of users into executable SQL is a key step for realizing data-driven answer, but in the prior art, when complex questions or questions in specific fields are processed, the questions with low accuracy often exist, and especially errors are easy to occur in the aspects of index selection, condition construction and the like. In addition, because the data structure and the business requirement of each application scene are different, the targeted training and fine tuning of the model not only needs a large amount of computing power resources, but also can cause the generalization capability of the model to be reduced, and meanwhile, when the effective SQL cannot be generated, the system often lacks an effective spam strategy, and the user experience is influenced. From the above, how to realize question-answer data retrieval and large model summarization without training and fine tuning for specific scenes, reduce complexity of model deployment, and improve resource utilization efficiency and accuracy of question-answer data retrieval and large model summarization are problems to be solved in the art.
Referring to fig. 1, the embodiment of the invention discloses a question-answer type data retrieval and large model summarization method, which specifically comprises the following steps:
Step S11, acquiring a natural language problem of a user, writing a prompt word for the natural language problem, determining an index range by utilizing the prompt word, and determining a target index corresponding to the natural language problem based on the index range.
In this embodiment, a natural language question of a user is obtained, a prompt word writing rule is determined based on the natural language question of the user and a domain knowledge graph is introduced, the writing rule and writing sentence are packaged as templates, the templates are filled and adjusted by the natural language question to generate prompt words, a target data table related to the natural language question is screened out from a preset data table by the prompt words, an index range is determined from the target data table, target prompt words are written according to the index range and the natural language question, and a target index corresponding to the natural language question is determined by the target prompt words.
Specifically, in natural language problems, a user typically queries information about one or more pre-set data sheets. Firstly, a preset data table related to a user problem needs to be determined, and the flow is as follows:
In order to determine the data table related to the user problem, firstly, a Prompt is required to be written, the Prompt comprises all possible list-building sentences, user problems, list-selecting rules and the like, the list-selecting rules can be determined according to keywords, phrases or contexts in the user problem, the target data table most relevant to the user problem is automatically selected by utilizing the semantic understanding capability of a universal large model based on the written Prompt, if the problem only relates to a single table, the step can be skipped, after the target data table related to the natural language problem of the user is determined, the indexes (namely columns in the target data table) related to the natural language problem are required to be further determined, a possible index range is defined according to list-selecting results, a target Prompt is again written based on indexes in the selected range, the natural language problem, the index rules and the like, and the target Prompt word most relevant to the natural language problem of the user is automatically selected by utilizing the semantic understanding capability of the universal large model.
In addition, the application adopts some optimization strategies to improve the writing efficiency and accuracy of the Prompt, for example, the Prompt can be written by using a templatization method, common table-building sentences, table-selecting rules, SQL generating rules and the like are packaged into templates, and filling and adjusting are carried out according to specific problems when needed.
Further, in certain specific fields (e.g., medical, financial, etc.), a user's natural language problem may involve a great deal of terminology and field knowledge. In order to deal with the problems, the application introduces the domain knowledge graph into the technical proposal, wherein the domain knowledge graph is a structured knowledge representation mode, and can represent the entities, attributes and relations in the domain in the form of a graph. By introducing the domain knowledge graph, more background knowledge and context information are provided for the technical scheme, so that the accuracy and efficiency of query are improved.
And step S12, generating a structured query statement based on the natural language question and the target index, inputting the structured query statement to a database server, and executing query operation.
In the embodiment, structured prompt words are written according to natural language questions of users, wherein the structured prompt words comprise time rules, region rules, structured query statement generation rules, background knowledge rules, statements and statement examples, one or more structured query statements are generated based on the natural language questions and the target indexes by utilizing NL2SQL technology and the structured prompt words, the structured query statements are input to a database server, and query operation is executed.
After the target data table and the target index related to the natural language problem of the user are determined, the SQL query statement is generated next, and the specific flow is as follows:
In order to generate SQL query sentences, firstly, a structured prompt word containing SQL generating rules is required to be written, wherein the structured prompt word contains SQL generating rules such as screening time rules, screening region rules and the like, and related background knowledge rules, table building sentences, related insert sentence examples of selected indexes, user problems and the like of the selected indexes;
and generating SQL (structured query language) based on the written structured prompt words, and automatically generating one or more SQL query sentences by utilizing the generating capability of the general large model, wherein the SQL query sentences can accurately reflect the intention of the user problem.
After the SQL query statement is generated, the SQL query statement is input to the database server and query operations are performed, and the database server returns query results that will be used for subsequent analysis and summarization.
And step S13, if the query operation is successful, outputting a query result to complete question-answer data retrieval, and then inputting the query result and the natural language questions into a preset model to be summarized so as to obtain a first question-answer type summary result.
And S14, if the query operation fails, screening out a search result from a preset knowledge base by taking the target index as a search keyword, filtering and sequencing the search result to obtain a target search result so as to complete question-answer data search, and then inputting the target search result and the natural language question into the preset model to be summarized so as to obtain a second question-answer summary result.
In this embodiment, if the query operation fails, a retry mechanism is started, the current retry times are recorded, and the process of generating the structured query statement is skipped to generate the next structured query statement; judging whether the current retry times are larger than a preset retry times threshold value if the query operation corresponding to the next structured query statement fails, acquiring special data related to each index if the current retry times are larger than the preset retry times threshold value, constructing a special knowledge base by using a retrieval enhancement generation technology, copying the special data to the special knowledge base in a one-to-one copying mode, acquiring summary data related to natural language problems of all users, constructing a summary knowledge base by using a retrieval enhancement generation technology, copying the summary data to the summary knowledge base in a one-to-one copying mode, wherein the preset knowledge base comprises the special knowledge base and the summary knowledge base, inputting the target index as a retrieval key word to the special knowledge base for retrieval, outputting a retrieval result if related data exists in the special knowledge base, inputting the target index as a summary to the knowledge base for retrieval, outputting the related data in a one-to-one copying mode, filtering the search result according to a ranking rule, filtering the search result, and filtering the search result according to the ranking rule, and filtering the search result according to the ranking rule, importance rules and relevance rules.
Specifically, the SQL query statement is input to the database server, and a query operation is performed, and the database server returns a query result, and if the query operation fails (e.g., due to a grammar error or a database connection problem), a retry mechanism is started, which may include adjusting a hint word and regenerating the SQL query statement, modifying a database connection parameter, and the like. In addition, a preset retry number threshold may be set to ensure that the method may be shifted to other processing strategies in time when a successful query is still not possible after multiple attempts.
If the current retry number is greater than the preset retry number threshold, it indicates that the SQL query statement cannot be successfully generated at this time or the query result does not meet the user's expectations, and at this time, the search needs to be performed by using a preset knowledge base so as to provide accurate answers for the user, and the specific flow is as follows:
(1) And constructing a preset knowledge base. The method comprises the steps of establishing a special knowledge base, establishing a special knowledge base by utilizing a search enhancement generation technology aiming at specific indexes, copying special data into the special knowledge base in a one-to-one copying mode to ensure the pertinence and the accuracy of search results, reasonably indexing and storing data in the knowledge base in order to support efficient search operation, and establishing a summary knowledge base, wherein the summary knowledge base can be established to include all data besides the special knowledge base, and can be used as a spam scheme to provide additional search opportunities when the special knowledge base cannot find matched data.
(2) And (5) searching a knowledge base. After the preset knowledge base is constructed, the next step is to realize the knowledge base searching function, and the indexes are extracted, namely, the target indexes corresponding to the natural language problem are extracted and used as search keywords for searching related data in the preset knowledge base.
And preferentially searching the special knowledge base based on the extracted target index. Since the specialized knowledge base contains only data related to the current index, the search results are generally more accurate and targeted.
And secondly, searching the summarized knowledge base, namely if the matched data cannot be found by the special knowledge base, turning to the summarized knowledge base for searching, wherein the summarized knowledge base can be used as a spam scheme to provide additional searching opportunities for users because the summarized knowledge base contains all data.
The retrieval threshold may be adjusted so that the retrieval threshold may be appropriately lowered in order to increase the recall rate of retrieval. This means that the matching requirements are relaxed during the search to find more data that may be relevant, however, this also increases the noise and redundancy of the search results, thus requiring filtering and sorting of the search results in subsequent steps.
(3) And filtering and sequencing results. After the relevant search results are obtained, the search results need to be filtered and ordered to ensure that the user obtains accurate and orderly answers.
Filtering, namely filtering the retrieved result according to the time, place, index and other conditions in the natural language problem of the user. The filtering operation may remove data that is not related to the problem or that is not eligible, thereby improving the accuracy and relevance of the results.
Ranking the filtered search results are required to be ranked in order to make it easier for the user to understand and accept the search results. The ranking may be based on factors such as timeliness, importance, relevance, etc. of the data. By the sorting operation, the results can be presented to the user more regularly and orderly.
And finally, inputting the target retrieval result and the natural language problem into a preset model to be summarized so as to obtain a second question-answer type summary result. To generate accurate summary results, we need to provide SQL statements, target search results, and natural language questions as input information to the pre-set model that can help the pre-set model understand the context and purpose of the query and generate answers (i.e., second question-and-answer summary results) that meet the user's expectations. Based on the input information, the preset model can automatically generate one or more summary results by utilizing the powerful semantic understanding and generating capability of the preset model. These summary results should be able to accurately reflect the content of the query results and be presented to the user in a concise and clear manner.
The first question-answer type summary result is generated in the same manner as the second question-answer type summary result. Also, since the search results may contain a plurality of related data points or pieces of information, the pre-set model also needs to have the ability to integrate such information into a coherent, organized answer.
The application combines the NL2SQL step-by-step decomposition technology and RAG (Retrieval Augmented Generation) technology to construct a question-answer data retrieval and large model summarization system, and the system comprises an NL2SQL module, an RAG module, a model summarization module and a user interface module, and the specific flow is shown in figure 2.
The NL2SQL module is used for generating an SQL query statement according to the natural language problem of a user and attempting to execute the query and mainly comprises a table selection step, an index determination step, an SQL generation step, a database query step and a retry mechanism step;
the RAG module is used for searching related data in a preset knowledge base based on the problem when the inquiry of the NL2SQL module fails, and filtering and sequencing the related data;
The model summarizing module is used for inputting the output result of the NL2SQL module or the RAG module and the natural language problem of the user into a preset model to summarize, so as to obtain a first question-answer summarizing result or a second question-answer summarizing result;
And the user interface module is used for receiving the natural language questions input by the user and displaying the first question-answer type summary results or the second question-answer type summary results summarized by the model.
The application utilizes the native capability of a general large model, does not need to train and finely tune aiming at a specific scene, reduces the cost and complexity of model deployment, remarkably improves the overall accuracy of the query number scene, particularly when processing complex or specific field problems, reduces the calculation power resources required by training and finely tune as much as possible on the premise of not sacrificing the performance of the model, improves the resource utilization efficiency, combines the double guarantee of NL2SQL and RAG, remarkably improves the accuracy of the query number scene, particularly when processing complex or specific field problems, and is more outstanding by high-efficiency NL2SQL step decomposition and RAG bottom pocket strategy, reduces unnecessary calculation power consumption, improves the resource utilization efficiency, ensures that user problems can be reasonably responded, and improves the robustness and user experience of the system.
In the embodiment, a natural language question of a user is acquired, a prompt word is written for the natural language question, an index range is determined by utilizing the prompt word, a target index corresponding to the natural language question is determined based on the index range, a structured query sentence is generated based on the natural language question and the target index, the structured query sentence is input to a database server and query operation is executed, if the query operation is successful, a query result is output to complete question-answer type data retrieval, then the query result and the natural language question are input to a preset model to be summarized to obtain a first question-answer type summarization result, if the query operation fails, the target index is used as a search keyword to screen a search result from a preset knowledge base, the search result is filtered and ordered to obtain a target search result, and then the target search result and the natural language summary question are input to the preset model to be summarized to obtain a second question-answer type data retrieval result. The method and the system write the prompt word for the natural language problem of the user so as to determine the target index, generate the structured query statement based on the natural language problem and the target index, and can improve the overall accuracy of a query number scene when the problem in complex or specific fields is processed, input the structured query statement into a database server and execute query operation, if the query operation is successful, output the query result to complete question-answer type data retrieval, input the query result and the natural language problem into a preset model to be summarized so as to obtain a first question-answer type summary result, utilize the native capability of a large model without training and fine adjustment for specific scenes, reduce the cost and complexity of model deployment, if the query operation fails, screen the target index as a search keyword from a preset knowledge base, filter and sort the search result to obtain a target search result, complete question-answer type data retrieval, input the target search result and the natural language problem into the preset model to be summarized so as to obtain a second question-answer type data retrieval, reduce unnecessary consumption, improve the utilization efficiency, further improve the utilization efficiency of the user experience after the database server fails, and further improve the utilization efficiency of the question-answer type data retrieval system and the user experience.
Referring to fig. 3, the embodiment of the invention discloses a question-answer type data retrieval and large model summarization device, which specifically comprises the following steps:
the index determining module 11 is configured to obtain a natural language question of a user, write a prompt word for the natural language question, determine an index range using the prompt word, and determine a target index corresponding to the natural language question based on the index range;
A query module 12, configured to generate a structured query statement based on the natural language question and the target index, input the structured query statement to a database server, and perform a query operation;
The first summarizing module 13 is configured to output a query result to complete question-answer data retrieval if the query operation is successful, and then input the query result and the natural language question into a preset model to summarize, so as to obtain a first question-answer summarizing result;
And the second summarizing module 14 is configured to, if the query operation fails, screen the target index as a search keyword from a preset knowledge base, filter and rank the search result to obtain a target search result, complete the question-answer data search, and input the target search result and the natural language question into the preset model for summarizing, so as to obtain a second question-answer summarizing result.
In the embodiment, a natural language question of a user is acquired, a prompt word is written for the natural language question, an index range is determined by utilizing the prompt word, a target index corresponding to the natural language question is determined based on the index range, a structured query sentence is generated based on the natural language question and the target index, the structured query sentence is input to a database server and query operation is executed, if the query operation is successful, a query result is output to complete question-answer type data retrieval, then the query result and the natural language question are input to a preset model to be summarized to obtain a first question-answer type summarization result, if the query operation fails, the target index is used as a search keyword to screen a search result from a preset knowledge base, the search result is filtered and ordered to obtain a target search result, and then the target search result and the natural language summary question are input to the preset model to be summarized to obtain a second question-answer type data retrieval result. The method and the system write the prompt word for the natural language problem of the user so as to determine the target index, generate the structured query statement based on the natural language problem and the target index, and can improve the overall accuracy of a query number scene when the problem in complex or specific fields is processed, input the structured query statement into a database server and execute query operation, if the query operation is successful, output the query result to complete question-answer type data retrieval, input the query result and the natural language problem into a preset model to be summarized so as to obtain a first question-answer type summary result, utilize the native capability of a large model without training and fine adjustment for specific scenes, reduce the cost and complexity of model deployment, if the query operation fails, screen the target index as a search keyword from a preset knowledge base, filter and sort the search result to obtain a target search result, complete question-answer type data retrieval, input the target search result and the natural language problem into the preset model to be summarized so as to obtain a second question-answer type data retrieval, reduce unnecessary consumption, improve the utilization efficiency, further improve the utilization efficiency of the user experience after the database server fails, and further improve the utilization efficiency of the question-answer type data retrieval system and the user experience.
In some specific embodiments, the index determining module 11 may specifically include:
the rule determining module is used for determining prompt word writing rules based on natural language problems of users and introducing domain knowledge graphs;
And the prompt word generation module is used for packaging the writing rules and writing sentences as templates, and filling and adjusting the templates by utilizing the natural language problems to generate prompt words.
In some specific embodiments, the index determining module 11 may specifically include:
The target data table screening module is used for screening target data tables related to the natural language problems from preset data tables by using prompt words;
And the target index determining module is used for determining an index range from the target data table, writing target prompt words according to the index range and the natural language problems, and determining target indexes corresponding to the natural language problems by utilizing the target prompt words.
In some specific embodiments, the query module 12 may specifically include:
the rule generation module is used for writing a structured prompt word according to the natural language problem of the user, wherein the structured prompt word comprises a time rule, a region rule, a structured query statement generation rule, a background knowledge rule, a statement and a statement example;
and the structured query sentence generation module is used for generating one or more structured query sentences based on the natural language questions and the target indexes by utilizing an NL2SQL technology and the structured prompt words.
In some specific embodiments, the second summarizing module 14 may specifically include:
The retry mechanism starting module is used for starting a retry mechanism if the query operation fails, recording the current retry times, and jumping to a flow for generating a structured query statement to generate a next structured query statement;
The judging module is used for judging whether the current retry number is larger than a preset retry number threshold value or not if the query operation corresponding to the next structured query statement fails;
And the first retrieval module is used for screening retrieval results from a preset knowledge base by taking target indexes corresponding to the natural language problems as retrieval keywords if the current retry times are larger than a preset retry times threshold value.
In some specific embodiments, the second summarizing module 14 may specifically include:
The special knowledge base construction module is used for acquiring special data related to each index, constructing a special knowledge base by utilizing a retrieval enhancement generation technology, and copying the special data into the special knowledge base in a one-to-one copying mode;
The system comprises a summary knowledge base construction module, a search enhancement generation technology and a storage module, wherein the summary knowledge base construction module is used for acquiring summary data related to natural language problems of all users, constructing a summary knowledge base by utilizing the search enhancement generation technology, and copying the summary data into the summary knowledge base in a one-to-one copying mode;
The second retrieval module is used for inputting the target index into the special knowledge base as a retrieval keyword to perform retrieval, and outputting a retrieval result if relevant data exist in the special knowledge base;
And the third retrieval module is used for inputting the target index into the summarized knowledge base as a retrieval keyword to retrieve if the related data does not exist in the special knowledge base, and outputting a retrieval result if the related data exists in the summarized knowledge base.
In some specific embodiments, the second summarizing module 14 may specifically include:
the filtering module is used for filtering the search result according to the time, the place and the index in the natural language problem of the user so as to obtain the filtered search result;
The sorting module is used for sorting the filtered search results according to a preset sorting rule, wherein the sorting rule comprises a timeliness rule, an importance rule and a relevance rule.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device 20 may include, in particular, at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input-output interface 25, and a communication bus 26. The memory 22 is used for storing a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the question-answer data retrieval and large model summarization method performed by the electronic device disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide working voltages for each hardware device on the electronic device 20, the communication interface 24 is capable of creating a data transmission channel with an external device for the electronic device 20, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein, and the input/output interface 25 is configured to obtain external input data or output data to the external device, and the specific interface type of the input/output interface may be selected according to the specific application needs and is not specifically limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon include an operating system 221, a computer program 222, and data 223, and the storage may be temporary storage or permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and the computer program 222, so as to implement the operation and processing of the data 223 in the memory 22 by the processor 21, which may be Windows, unix, linux or the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the question-answer data retrieval and large model summarization methods performed by the electronic device 20 disclosed in any of the foregoing embodiments. The data 223 may include, in addition to the data received by the question-answer data retrieval and large model summarization device and transmitted by the external device, data collected by the own input-output interface 25, and the like.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Further, the embodiment of the application also discloses a computer readable storage medium, wherein the storage medium stores a computer program, and when the computer program is loaded and executed by a processor, the steps of the question-answer data retrieval and large model summarization method disclosed in any embodiment are realized.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing has described in detail the methods, apparatus, devices and storage media for question-answer data retrieval and large model summarization provided by the present invention, and specific examples are applied herein to illustrate the principles and embodiments of the present invention, and the above description of the examples is only for aiding in understanding the methods and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510372120.2A CN120162425A (en) | 2025-03-27 | 2025-03-27 | Question-and-answer data retrieval and large model summary method, device, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510372120.2A CN120162425A (en) | 2025-03-27 | 2025-03-27 | Question-and-answer data retrieval and large model summary method, device, equipment and medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN120162425A true CN120162425A (en) | 2025-06-17 |
Family
ID=96009018
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202510372120.2A Pending CN120162425A (en) | 2025-03-27 | 2025-03-27 | Question-and-answer data retrieval and large model summary method, device, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN120162425A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121144464A (en) * | 2025-09-19 | 2025-12-16 | 讯飞清环(苏州)科技有限公司 | A smart questioning method and related device |
| CN121256003A (en) * | 2025-10-28 | 2026-01-02 | 厦门海创星智科技有限公司 | Question and answer method, device, equipment and storage medium based on large language model |
| CN121456227A (en) * | 2025-10-21 | 2026-02-03 | 山东浪潮科学研究院有限公司 | Multi-source information processing method, system, equipment and medium based on dynamic perception and intelligent response |
| CN121996755A (en) * | 2025-12-31 | 2026-05-08 | 中国电力科学研究院有限公司 | Intelligent power data question-answering method and device based on efficient fine tuning and tool calling |
Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017010652A1 (en) * | 2015-07-15 | 2017-01-19 | 포항공과대학교 산학협력단 | Automatic question and answer method and device therefor |
| CN118036753A (en) * | 2024-03-25 | 2024-05-14 | 行至智能(北京)技术有限公司 | A large language model reasoning method and system based on multi-level knowledge retrieval enhancement |
| CN118394890A (en) * | 2024-06-28 | 2024-07-26 | 宏景科技股份有限公司 | Knowledge retrieval enhancement generation method and system based on large language model |
| CN118885559A (en) * | 2024-04-19 | 2024-11-01 | 华院计算技术(上海)股份有限公司 | A real-time interactive question-answering system, method and device integrating vectorized retrieval and large model technology |
| CN118981522A (en) * | 2024-07-26 | 2024-11-19 | 睿宇时空科技(重庆)股份有限公司 | Database AI question answering system and method based on large language model and retrieval enhancement |
| CN119003563A (en) * | 2024-08-08 | 2024-11-22 | 浪潮云信息技术股份公司 | Method for correcting nonstandard SQL (structured query language) sentences based on large language model |
| CN119128117A (en) * | 2024-11-13 | 2024-12-13 | 星凡星启(成都)科技有限公司 | An intelligent reply method and device integrating large language model and knowledge graph |
| CN119441255A (en) * | 2024-10-25 | 2025-02-14 | 浪潮卓数大数据产业发展有限公司 | A data statistical analysis method, device and medium for intelligent question and answer |
| CN119441261A (en) * | 2024-10-15 | 2025-02-14 | 招商银行股份有限公司 | Language conversion method, device and storage medium based on retrieval enhancement |
| CN119691106A (en) * | 2024-11-15 | 2025-03-25 | 深圳市金证优智科技有限公司 | Intelligent question-answering method, device, equipment, storage medium and program product |
-
2025
- 2025-03-27 CN CN202510372120.2A patent/CN120162425A/en active Pending
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2017010652A1 (en) * | 2015-07-15 | 2017-01-19 | 포항공과대학교 산학협력단 | Automatic question and answer method and device therefor |
| CN118036753A (en) * | 2024-03-25 | 2024-05-14 | 行至智能(北京)技术有限公司 | A large language model reasoning method and system based on multi-level knowledge retrieval enhancement |
| CN118885559A (en) * | 2024-04-19 | 2024-11-01 | 华院计算技术(上海)股份有限公司 | A real-time interactive question-answering system, method and device integrating vectorized retrieval and large model technology |
| CN118394890A (en) * | 2024-06-28 | 2024-07-26 | 宏景科技股份有限公司 | Knowledge retrieval enhancement generation method and system based on large language model |
| CN118981522A (en) * | 2024-07-26 | 2024-11-19 | 睿宇时空科技(重庆)股份有限公司 | Database AI question answering system and method based on large language model and retrieval enhancement |
| CN119003563A (en) * | 2024-08-08 | 2024-11-22 | 浪潮云信息技术股份公司 | Method for correcting nonstandard SQL (structured query language) sentences based on large language model |
| CN119441261A (en) * | 2024-10-15 | 2025-02-14 | 招商银行股份有限公司 | Language conversion method, device and storage medium based on retrieval enhancement |
| CN119441255A (en) * | 2024-10-25 | 2025-02-14 | 浪潮卓数大数据产业发展有限公司 | A data statistical analysis method, device and medium for intelligent question and answer |
| CN119128117A (en) * | 2024-11-13 | 2024-12-13 | 星凡星启(成都)科技有限公司 | An intelligent reply method and device integrating large language model and knowledge graph |
| CN119691106A (en) * | 2024-11-15 | 2025-03-25 | 深圳市金证优智科技有限公司 | Intelligent question-answering method, device, equipment, storage medium and program product |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN121144464A (en) * | 2025-09-19 | 2025-12-16 | 讯飞清环(苏州)科技有限公司 | A smart questioning method and related device |
| CN121456227A (en) * | 2025-10-21 | 2026-02-03 | 山东浪潮科学研究院有限公司 | Multi-source information processing method, system, equipment and medium based on dynamic perception and intelligent response |
| CN121256003A (en) * | 2025-10-28 | 2026-01-02 | 厦门海创星智科技有限公司 | Question and answer method, device, equipment and storage medium based on large language model |
| CN121996755A (en) * | 2025-12-31 | 2026-05-08 | 中国电力科学研究院有限公司 | Intelligent power data question-answering method and device based on efficient fine tuning and tool calling |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR102259390B1 (en) | System and method for ensemble question-answering | |
| CN109284363B (en) | Question answering method and device, electronic equipment and storage medium | |
| US10586155B2 (en) | Clarification of submitted questions in a question and answer system | |
| US7809703B2 (en) | Usage of development context in search operations | |
| US10891334B2 (en) | Learning graph | |
| CN102411580B (en) | The search method of XML document and device | |
| CN119886332A (en) | Question and answer method and device based on large language model, electronic equipment and computer program product | |
| CN117931983A (en) | Method and system for generating accurate answer by using large model | |
| CN118981475A (en) | SQL statement generation method and device based on large model | |
| CN118585537A (en) | SQL query statement generation system and method | |
| CN118485065A (en) | Document generation method and device, storage medium and electronic equipment | |
| CN117290481A (en) | Question and answer methods, devices, storage media and electronic equipment based on deep learning | |
| CN118820285A (en) | Method, system and device for generating sentences from text to structured query language | |
| CN115292322A (en) | Data query method, device, equipment and medium | |
| CN120235124A (en) | Report generation method and device based on large language model | |
| CN119357367A (en) | Method, device and storage medium for processing user questions and answers | |
| CN120317348A (en) | Enhanced retrieval generation method and device based on document structure knowledge graph | |
| CN120046711A (en) | Knowledge graph enhanced large model generation method driven by logic reasoning | |
| CN119293153A (en) | A method and system for solving science problems based on aligned thinking chains | |
| CN118690006A (en) | Question and answer method, device and storage medium | |
| US12743416B2 (en) | Query response generation by integrating adaptive retrieval-augmented generation with large language model | |
| CN119808714A (en) | RAG re-ranking method based on pruning optimization for tree-structured documents | |
| CN118964434A (en) | Multi-scale multi-channel information enhancement method, system and electronic device based on large model | |
| CN120030124A (en) | Dialogue method, electronic device and storage medium | |
| CN117827674A (en) | Defect and test case matching method and device, electronic equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |