Large language model government affair intelligent question and answer method, system and device and medium
By indexing the answers to government affairs questions, rewriting and splitting the questions, and combining with multiple recall query, the large language model answers inaccurate questions in government affairs questions and answers are solved, and the accuracy and efficiency of the answers are improved.
Patent Information
- Application Number
- CN202411528125.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-28
AI Technical Summary
Large language models are prone to "illusion" defects when answering government affairs questions, resulting in inaccurate answer results, and traditional text keyword extraction technology is difficult to accurately extract keywords in government affairs question-and-answer scenarios, resulting in inaccurate search results.
By indexing the content of the question answers to participate, including propositionalization of file content, document recursion, text blocking, and document question-and-answer, a tree structure is formed and stored in the vector library. At the same time, the original problem is rewritten and split, and multiple recall queries are used to improve the matching accuracy of the problem and related content.
It improves the quality and accuracy of the answer results of large language models, avoids the "illusion" defects caused by answering, and enhances the efficiency and accuracy of question-and-answer.
Smart Images

Figure CN119537529A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent question answering technology, and in particular to a large language model government affairs intelligent question answering method, system, device and medium. Background Art
[0002] With the development and construction of government service informatization, the goal of providing better services to the people and reducing the workload of grassroots personnel is to achieve the goal of providing better services to the people and reducing the workload of grassroots personnel. Therefore, the construction of intelligent assistants is a difficult and key issue in the research of government service informatization. At present, intelligent assistants use text keyword extraction technology to retrieve question-and-answer related content. However, due to the large number of proprietary words and long phrases in government question-and-answer scenarios, it is easy to extract incomplete or impossible keywords, resulting in low accuracy in retrieving related content. At the same time, with the rise of large language model technology, it has begun to take advantage of the understanding ability of large language models to directly answer questions through large language models. However, due to the fast update speed of policy documents, the existence of validity periods, and the local characteristics of policies, and for the large language model itself, it takes a long time to train the model and there will be "hallucination" defects when answering. Among them, the most fatal defect in the hallucination defect is that the content looks real on the surface, but it does not actually exist. Therefore, the overall accuracy of directly using large language models to answer is also low.
[0003] The answers given by current smart assistants are always long and lack summary. Although the answers contain the answers to the questions, the consultants need to read and understand them by themselves, which increases the consultants' time cost and makes them prefer to go for offline consultation, which easily leads to a waste of resources and fails to reduce the workload of grassroots staff.
[0004] Therefore, it is concluded that the main problems in the prior art are:
[0005] 1. Incomplete or incomplete keyword extraction: In government Q&A scenarios, due to the presence of a large number of proprietary words and long phrases, traditional text keyword extraction technology is difficult to accurately extract all relevant keywords, resulting in a low accuracy rate for retrieving relevant content;
[0006] 2. The “hallucination” defect of large language models: Although large language models have advantages in understanding ability, they may have “hallucinations” when answering policy-related questions, that is, generating content that seems to be real but does not actually exist, which will affect the accuracy of the answer;
[0007] 3. Rapid update speed of policy documents and local issues: The rapid update of policy documents and local differences require intelligent assistants to update the knowledge base in a timely manner to provide accurate and relevant information;
[0008] 4. Lack of summary and induction in the answers: The answers provided by intelligent assistants are often long and lack effective summary and induction, which increases the time cost of the consultant to understand and find answers and reduces the user experience;
[0009] 5. Waste of resources and no reduction in the burden on grassroots staff: Since smart assistants fail to provide efficient and accurate services, consultants are more inclined to choose offline consultation, which not only increases the consultant's time cost, but also fails to achieve the purpose of reducing the burden on grassroots staff. Summary of the invention
[0010] The technical problem to be solved by the present invention is that the large model has a "hallucination" defect problem when answering, the question-answering process is inefficient, and the result accuracy is low. The purpose is to provide a large language model government affairs intelligent question-answering method, system, device and medium, by indexing the content of the questions that need to be answered, the accuracy of matching questions with related content is improved, and the accuracy of matching questions with related content is improved by rewriting, splitting and multi-way recalling questions. By locating the original file content that meets the question, the quality and accuracy of the answer results of the large language model are improved, the hallucinations generated when the large model answers are prevented, and the efficiency and accuracy of question-answering are improved.
[0011] The present invention is achieved through the following technical solutions:
[0012] The first aspect of the present invention provides a large language model government affairs intelligent question answering method, comprising the following specific steps:
[0013] Obtain the incoming data, perform index processing on the incoming data, obtain the index data and store it in the database;
[0014] Rewrite the original problem by indexing the data;
[0015] Split the rewritten question, perform a query based on the split question, and obtain the query result;
[0016] Based on the query results, multi-way recall is used to query the document data matching the sub-questions to determine the question matching degree of the document data;
[0017] Based on the matching degree, the original document is located and extracted from the database to generate the answer to the question.
[0018] Furthermore, the indexing of the stored data specifically includes:
[0019] Get the updated policy document corresponding to the answer to the question as the input data, and name the input data;
[0020] The named incoming files are split according to the character length threshold, and the split data are sliced and spliced to form text blocks;
[0021] Cluster the text blocks to generate a tree structure;
[0022] Add labels to the text blocks and store them in the vector library. Each text block corresponds to at least one proposition unit.
[0023] Convert documents into question-answer pairs and generate a question-answer index.
[0024] Furthermore, slicing and splicing the split data includes:
[0025] Check the completeness of the sentence that needs to be sliced and spliced:
[0026] If it is judged to be a complete sentence, it will be sliced and spliced;
[0027] If it is judged to be an incomplete sentence, the previous incomplete sentence will be put into the beginning of the next slice in a complete form in the next segment.
[0028] Furthermore, rewriting the original question by indexing the data specifically includes:
[0029] Obtain prompt words, and rewrite the original question according to the prompt words, wherein the prompt words include:
[0030] Role assignment: specify roles for large language models;
[0031] Task specification: define the tasks that the large language model needs to complete, including the dimensions of region, policy type, specific policy measures, policy implementation time, and service object scope;
[0032] Format specification: Specify the format of the output answer of the large language model.
[0033] Furthermore, the rewritten question is split to expand a single query into multiple related sub-questions, including:
[0034] Semantically rewrite the input question to generate multiple sub-questions;
[0035] Based on multiple sub-questions, a single query is expanded into a multi-question search corresponding to multiple related sub-questions;
[0036] The obtained search results are merged and the merged search results are input into the large model to generate corpus information.
[0037] Furthermore, the method of using a multi-way recall query for document data matching the sub-question to determine the question matching degree of the document data specifically includes:
[0038] Determine the database type based on the multi-question search results, where the database includes:
[0039] A relational database is used to store information on policy documents, including: policy document name, policy effective time, policy source, and policy region information;
[0040] A non-relational database used to store original policy documents and question-and-answer results;
[0041] Vector database, used to store index data;
[0042] Combine corpus information to obtain semantic relationships between matching documents in different databases and generate corresponding query statements;
[0043] According to the corresponding query statement, the document data that is semantically relevant to the query statement is filtered out.
[0044] Furthermore, obtaining the semantic relationship between matching documents in different databases includes:
[0045] Use large language models (LLMs) to generate query vectors and retrieve semantically relevant document information from the vector database;
[0046] Use Large Language Model (LLM) to generate SQL query statements to retrieve required structured data from relational databases;
[0047] Large Language Model (LLM) is used to generate hybrid retrieval queries, which obtain data content from vector database and relational database respectively.
[0048] A second aspect of the present invention provides a system, which is applied to a large language model government affairs intelligent question answering method, comprising:
[0049] The question content input module is used to obtain the updated policy documents corresponding to the question answers as the input data;
[0050] A question rewriting module is used to rewrite the question content input by the user according to the updated policy file corresponding to the answer to the question;
[0051] The question thinking module is used to submit the rewritten questions to the large language model for question thinking and analysis;
[0052] The problem splitting and strategy selection module is used to split the problem into multiple sub-problems according to the input content of the problem thinking module;
[0053] The sub-question information aggregation module is used to combine the search results of multiple sub-questions with the question to generate corpus information;
[0054] The large language model answering module is used to combine corpus information, obtain the semantic relationship between matching documents in different databases, generate corresponding query statements, and answer questions;
[0055] An answer result evaluation module is used to evaluate the answer result;
[0056] The result storage module is used to store question and answer data.
[0057] A third aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a large language model government affairs intelligent question-answering method when executing the program.
[0058] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a large language model government affairs intelligent question-answering method.
[0059] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0060] By processing the content of questions that need to be answered, such as document content proposition, document recursion, text block, and document question-answering, the accuracy of matching questions with related content can be improved from the index side.
[0061] Improve the accuracy of matching questions with relevant content from the retrieval side by rewriting, splitting and multi-way recalling questions;
[0062] By retrieving the accuracy of information related to the question, the original file content that matches the question is located, and the content is provided to the large language model for answering the question, so as to improve the quality and accuracy of the large language model's answer results, and avoid the defect of "hallucination" when the large model answers. At the same time, the advantage of the large prediction model's ability to understand the problem is used in the method of improving the matching degree between the question and the relevant content, so as to improve the matching degree of the retrieved information and provide the large language model with more relevant corpus information. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without creative work. In the drawings:
[0064] Figure 1 is a flow chart of intelligent question and answer in an embodiment of the present invention;
[0065] Figure 2 A document recursive structure diagram in an embodiment of the present invention;
[0066] Figure 3A diagram showing the structure of a document question-and-answer system in an embodiment of the present invention;
[0067] Figure 4 It is a diagram of problem splitting and multi-query structure in an embodiment of the present invention;
[0068] Figure 5 is the semantic relationship between matching documents in different databases in the embodiment of the present invention;
[0069] Figure 6 This is the structure of the intelligent question answering system in an embodiment of the present invention. DETAILED DESCRIPTION
[0070] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.
[0071] As a possible implementation, Figure 1 As shown, this embodiment provides a large language model government affairs intelligent question-answering method, including the following specific steps: obtaining the stored data, indexing the stored data, obtaining the index data and storing it in the database; rewriting the original question through the index data; splitting the rewritten question, querying based on the split question, and obtaining the query result; based on the query result, using multi-way recall to query the document data matching the sub-question, and determining the question matching degree of the document data; locating and extracting the original file from the database based on the matching degree, and generating the answer to the question. By performing a series of content storage processing such as file content proposition, document recursion, text block, and document question-answering on the content that needs to participate in the question answer, the accuracy of matching between the question and the relevant content is improved from the index side. By rewriting the question, splitting the question and multi-way recalling, the accuracy of matching between the question and the relevant content is improved from the retrieval side. By retrieving the accuracy of the information related to the question, the original file content that meets the question is located, and the content is provided to the large language model for answering the question, so as to improve the quality and accuracy of the answer result of the large language model, and avoid the defect problem of "hallucination" when the large model answers.
[0072] Specifically, the following are possible implementation methods of this implementation:
[0073] 1.1. Document content proposition
[0074] Policy documents contain statements about multiple topics. Although these statements may be related to one thing, they may become useless information in some questions, which will reduce the accuracy of the search process. For example, in the policy about preferential subsidies for enterprises, it may mention the industries and enterprises that can enjoy subsidies, the regions that can enjoy subsidies, and the validity period of the subsidy policy. When the question is about the industries and enterprises that can enjoy subsidies, the regions that can enjoy subsidies and the validity period of the subsidy policy are useless information in the document. Therefore, the policy document is divided into three parts by topic to express three different facts.
[0075] The propositionalization of text content includes: decomposing the stored data into small, unique facts. Facts contain all the information by themselves and do not need to rely on other fragments for interpretation. The fragments that have been contextualized become propositions. Propositions contain more detailed and complete content and have higher information density. The format for storing in the vector library is as follows: "Policy Document Name" - Information about the content of the proposition.
[0076] 1.2. Document recursion
[0077] There is a context in the policy document, and there are associations and hierarchical relationships between knowledge. For example, in the "general-specific-general" structure, a statement about a piece of knowledge may have the first and last paragraphs, and the middle paragraphs describe the knowledge in different directions. Therefore, when the text is vectorized, slicing will destroy the contextual relationship in the article, and each block is treated equally during retrieval, which cannot capture the potential hierarchical relationship in the document collection and the association relationship propagated across blocks.
[0078] The core idea of document recursion is "clustering and summarizing, summarizing layer by layer". In each layer of document recursion, the text blocks are first clustered. Clustering will group text blocks with similar content together, and then the large language model is used to summarize and summarize the clustered content. In the next layer of recursion, the summary is clustered and summarized again. After layers of recursion, a hierarchical tree structure is finally generated. Finally, the original text blocks and the summary generated after clustering are stored in the vector library.
[0079] like Figure 2 As shown in Figure 1, this tree structure can capture the correlation and hierarchical relationships between different parts of a document. In the document tree, the leaves at the end are the original document blocks; the branches closer to the root represent higher-level integrated information across similar text blocks.
[0080] 1.3. Document Q&A
[0081] like Figure 3As shown in the figure, document question-answering refers to generating hypothetical questions by analyzing the document content through a large language model, and searching by focusing on the similarity between questions. Generating hypothetical questions based on the document content can capture the potential meaning behind the question and the connection between the contextual content, making the question more relevant to the document content.
[0082] 1.4. Text block - consistent length of storage
[0083] Since long phrases, special words, proprietary words, semicolons are often used between points in the policy original document, and detailed content is often used, the original policy document content is first split, and the split is split in sequence with a period as a separator to ensure the integrity of the words and sentences.
[0084] Then, the split content is sliced and spliced into text blocks according to the length of 1024 characters. The following factors are considered for splicing with a length of 1024 characters: 1. Since the input content is expanded, it is necessary to ensure that the length of the input content is not greater than the length of the vector library content data. 2. In order to verify the integrity of the sentence while satisfying the data length in the vector library to reduce the interference of inconsistent length on the similarity of the retrieval results, it is easy for the last part of the content in the slice to be an incomplete sentence. Therefore, in order to ensure the integrity of the sentence, the previous incomplete sentence will be put back into the beginning of the next slice in a complete form in the next segment. Therefore, if the length is too short, it will cause a lot of repetitions, and too much repetition will also affect the similarity calculation results. Through experimental verification of different lengths, it was found that the effect was best with a length of 1024 characters.
[0085] 1.5. Add tags to text blocks
[0086] Add tags to all text blocks stored in the vector library. Tags are used to classify, sort, and filter based on various attributes. In the government Q&A scenario, the following types of tags are added: date, subject, source, and relevant department. After adding tags to the text blocks, the search scope can be limited based on the tags, improving the accuracy of vector library retrieval.
[0087] 2. Rewrite the original question
[0088] Rewriting the original question is to use the large language model to rephrase the user's original question. Most of the questions asked by users are too brief, lack key information, and have unclear intentions. Rewriting the original question can improve the accuracy of retrieval. When rewriting the large language model, it is necessary to add prompt words to assist the large language model in question rewriting. The prompt words need to include the following content:
[0089] Specify the role and tell the big language model what role it plays. A clear role helps set the model's response style and professional field. For example, if you are a government affairs Q&A consultant, you can make reasonable suggestions on government affairs issues.
[0090] Clarify the task and define the specific task or question to be completed. This will make the large language model more clear when thinking about the answer and generate useful responses. For example, the original question of the following user is rewritten into a more specific and clear question, including the region, policy type, specific policy measures, policy implementation time, and service object scope dimensions, in order to better improve the retrieval similarity in the vector library and improve the accuracy;
[0091] Specify the format to make the answer clear, so that the output is more in line with the user's usage habits.
[0092] For example, the question is: What are the policies that benefit enterprises this year? The large language model answers: Based on these aspects, the following are several expanded sample questions: Questions about location: "What policies that benefit enterprises have been introduced in Shenzhen in 2024?" Questions about policy types: "What financial support measures are included in the policies that benefit enterprises in 2024?" Questions about enterprise types: "What policies that benefit enterprises can small and micro enterprises receive in 2024?" Questions that combine time and location: "What new policies that benefit enterprises have been introduced in Shandong Province in the first quarter of 2024?" Questions that focus on policy effects: "How do enterprises evaluate the help of the policies that benefit enterprises in 2024 to their business?"
[0093] 3. Question splitting and multiple queries
[0094] like Figure 4 As shown in the figure, question splitting and multi-query is to expand a single query into multiple related sub-questions for querying, thereby enriching the diversity and coverage of the above content. For example, the user asks: [What is the difference between Policy 1 and Policy 2], and there is relevant content information about Policy 1 and Policy 2 in the vector library, but there is no document information comparing the two. In this case, if you can retrieve the content of Policy 1 and Policy 2 separately, then merge the retrieved content and hand it over to the large language model for answering.
[0095] 4. Multi-channel recall strategy
[0096] Taking advantage of the various database storage methods, generate appropriate query strategies based on different data sources and requirements.
[0097] The content of the storage vector library is suitable for matching the semantic relationship between documents. The vector storage is used to find the document that is most semantically equivalent to the query statement.
[0098] Regarding storage, relational database content is suitable for storing and querying massive amounts of structured data. It provides powerful query capabilities and data consistency advantages, making it suitable for scenarios that require complex data operations.
[0099] Different database types are also suitable for storing different types of data.
[0100] Regarding the use of relational databases for storing structured data, there are significant advantages in processing relational data in relational databases.
[0101] The vector database is used to store unstructured data. The vector database converts unstructured data such as text and images into vectors through vectorization technology, and searches and matches them by similarity.
[0102] like Figure 5 As shown in the figure, regarding the construction query request of the multi-channel recall strategy, appropriate query statements are generated according to different data sources and requirements, for example:
[0103] Text-to-metadata-filter: Use LLM to generate query vectors and retrieve semantically relevant document information content from the vector database.
[0104] Text-to-SQL: Use LLM to generate SQL query statements to retrieve the required structured data from the relational database.
[0105] Text-to-SQL+Semantic: Use LLM to generate hybrid retrieval queries and obtain data content from vector databases and relational databases respectively.
[0106] 5. Database Type
[0107] Relational database, storing policy document ledger information content, including: policy document name, policy effective time, policy source, policy region information. Function 1: Perform health check on the content in non-relational database and vector database, and regularly clear expired data and add new data to avoid low-level errors when answering, for example, the information provided to users comes from expired policy documents. Function 2: Used to answer, count, and screen such questions, for example, "What policies are valid in a certain time period?" "What preferential policies can still be participated by the end of this year?"
[0108] Non-relational databases have obvious advantages in storing files and unstructured data, such as accurate retrieval positioning and fast retrieval speed. They are suitable for storing long content information such as original policy documents and question and answer results. These contents are provided as reference content to the large language model for question answering.
[0109] Vector database, in the vector database, is used to store the information content that has been vectorized about the propositionalization of file content, document recursion, text blockization, and document question and answering. The format of the data content stored in the vector library is unified as "for participating in the retrieval of quantified information-policy file name".
[0110] As a possible implementation, Figure 6 As shown, this embodiment provides a large language model government affairs intelligent question answering system, including:
[0111] The question content input module is used to obtain the updated policy documents corresponding to the question answers as the input data;
[0112] The question rewriting module is used to rewrite the question content input by the user according to the updated policy file corresponding to the answer to the question, and present the content to the user after the question is rewritten. If the user is satisfied with the rewritten result, the rewritten question will be used; if the rewritten question is not satisfactory to the user, the user can supplement the question again through the reference provided by the large language model, or choose not to supplement and use the question content entered at the beginning.
[0113] The problem thinking module submits the rewritten problem to the large language model for thinking and analysis. In order to make the problem analysis direction controllable, a prompt word project needs to be added. The prompt words for problem thinking need to include the following content: First, all possible problem types need to be listed as clearly as possible in the prompt words, and all problem types need to be explained. The purpose is to provide reference content for the large language model to control the thinking direction when thinking about the input content. Then, the large language model is required to analyze the input problem. The result must come from the provided problem type. Finally, the large language model is required to output content in the format of "problem type-explanation reason", and the large language model must strictly follow the content defined by the provided problem type during the analysis process to think about the problem, and must not analyze the problem divergently.
[0114] The question splitting and strategy selection module splits the question into multiple sub-questions based on the content information provided by the question thinking module. The question is split using a large language model plus prompt words. The prompt words for the question splitting part need to include the following related content: first, input the content information generated in the question thinking part to the large language model, then clearly inform the large language model that the question needs to be split into multiple sub-questions based on the question type and the explanation reason, and then provide the large language model with specific content descriptions about the multi-way recall strategy, so that the large language model can select a specific strategy for the question through the specific description, and the strategy is required to come from the provided strategy type.
[0115] The sub-question retrieval module searches for sub-questions that have been split and selected by the question splitting and strategy selection modules according to the corresponding strategies. If the question only uses the Text-to-metadata-filter strategy, it searches for the content of the stored file in the form of propositions, documents in the form of recursion, text blocks, and documents in the form of question and answer, and only retrieves the top three data contents in terms of similarity. If the question only uses the Text-to-SQL strategy, all the retrieved content information is directly obtained. If the Text-to-SQL+Semantic strategy is used, the content is obtained according to the corresponding strategies.
[0116] Sub-question information aggregation module. In this module, due to the adoption of the Text-to-metadata-filter strategy, the sub-questions will provide content that brings back a lot of information. If this information is provided to the large language model in its original form, an answer illusion will appear. The content may come from multiple policy documents. If it is not distinguished, the large language model will think that the content comes from the same file, so the returned content needs to be deduplicated. The deduplication rule is to deduplicate according to the file name from which this information comes, and retain the file name used. If the Text-to-SQL strategy is adopted, the search results are combined with the question to make it into a corpus information. For example, the question: How many preferential policies related to the field of artificial intelligence has the government issued by the end of this year? The result after searching through the SQL statement is 5, and the output result is: As of the end of this year, the government has issued 5 preferential policies related to the field of artificial intelligence.
[0117] The large language model answer module, after passing through the sub-question information aggregation module, will obtain all the corpus information content related to the question, and then locate the original file content from the non-relational database through the file name associated with the relevant corpus information content, and then use the located original file content for question answering. The advantage of the large language model answer is that the more relevant information is provided, the more accurate the answer result.
[0118] The answer result evaluation module can evaluate the results in the following ways after outputting the results: 1. The user directly answers the result to evaluate 2. If the user chooses to regenerate the answer, if the user chooses to regenerate the answer, it means that the answer result is not satisfactory 3. If no action is taken on the generated result or a new question is asked, it is assumed that the answer result is satisfactory.
[0119] The result storage module stores the satisfactory answer data into a non-relational database according to the question name, file name, and file validity date format through the answer result evaluation module, and stores the question content in a unified format for storing in a vector library.
[0120] As a possible implementation method, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, a large language model government affairs intelligent question and answer method is implemented.
[0121] As a possible implementation, this embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, a large language model government affairs intelligent question answering method is implemented.
[0122] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A large language model government affairs intelligent question answering method, characterized in that: The specific steps include: Obtain the incoming data, perform index processing on the incoming data, obtain the index data and store it in the database; Rewrite the original problem by indexing the data; Split the rewritten question, perform a query based on the split question, and obtain the query result; Based on the query results, a multi-way recall query is used to find the document data that matches the sub-question, and the question matching degree of the document data is determined; Based on the matching degree, the original document is located and extracted from the database to generate the answer to the question.
2. The large language model government affairs intelligent question answering method according to claim 1 is characterized in that: The indexing of the incoming data specifically includes: Get the updated policy document corresponding to the answer to the question as the input data, and name the input data; The named incoming files are split according to the character length threshold, and the split data are sliced and spliced to form text blocks; Cluster the text blocks to generate a tree structure; Add labels to the text blocks and store them in the vector library. Each text block corresponds to at least one proposition unit. Convert documents into question-answer pairs and generate a question-answer index.
3. The large language model government affairs intelligent question answering method according to claim 2 is characterized in that: The slicing and splicing of the split data includes: Check the completeness of the sentence that needs to be sliced and spliced: If it is judged to be a complete sentence, it will be sliced and spliced; If it is judged to be an incomplete sentence, the previous incomplete sentence will be put into the beginning of the next slice in a complete form in the next segment.
4. The large language model government affairs intelligent question answering method according to claim 1 is characterized in that: The original question is rewritten by indexing the data, specifically including: Obtain prompt words, and rewrite the original question according to the prompt words, wherein the prompt words include: Role assignment: specify roles for large language models; Task specification: define the tasks that the large language model needs to complete, including the dimensions of region, policy type, specific policy measures, policy implementation time, and service object scope; Format specification: Specify the format of the output answer of the large language model.
5. The large language model government affairs intelligent question answering method according to claim 1 is characterized in that: The rewritten question is split to expand a single query into multiple related sub-questions, including: Semantically rewrite the input question to generate multiple sub-questions; Based on multiple sub-questions, a single query is expanded into a multi-question search corresponding to multiple related sub-questions; The obtained search results are merged and the merged search results are input into the large model to generate corpus information.
6. The large language model government affairs intelligent question answering method according to claim 5 is characterized in that: The method of using multiple recalls to query the document data matching the sub-questions and determining the question matching degree of the document data specifically includes: Determine the database type based on the multi-question search results, where the database includes: A relational database is used to store information on policy documents, including: policy document name, policy effective time, policy source, and policy region information; A non-relational database used to store original policy documents and question-and-answer results; Vector database, used to store index data; Combine corpus information to obtain semantic relationships between matching documents in different databases and generate corresponding query statements; According to the corresponding query statement, the document data that is semantically relevant to the query statement is filtered out.
7. The large language model government affairs intelligent question answering method according to claim 1 is characterized in that: The obtaining of semantic relations between matching documents in different databases includes: Use large language models (LLMs) to generate query vectors and retrieve semantically relevant document information from the vector database; Use Large Language Model (LLM) to generate SQL query statements to retrieve required structured data from relational databases; Large Language Model (LLM) is used to generate hybrid retrieval queries, which obtain data content from vector database and relational database respectively.
8. A large language model government affairs intelligent question answering system, applied to the large language model government affairs intelligent question answering method according to any one of claims 1 to 7, characterized in that: include: The question content input module is used to obtain the updated policy documents corresponding to the question answers as the input data; A question rewriting module is used to rewrite the question content input by the user according to the updated policy file corresponding to the answer to the question; The question thinking module is used to submit the rewritten questions to the large language model for question thinking and analysis; The problem splitting and strategy selection module is used to split the problem into multiple sub-problems according to the input content of the problem thinking module; The sub-question information aggregation module is used to combine the search results of multiple sub-questions with the question to generate corpus information; The large language model answering module is used to combine corpus information, obtain the semantic relationship between matching documents in different databases, generate corresponding query statements, and answer questions; An answer result evaluation module is used to evaluate the answer result; The result storage module is used to store question and answer data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, it implements the large language model government affairs intelligent question answering method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the large language model government affairs intelligent question answering method as described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Multi-label generation matching RAG intelligent question-answering method, device and equipment and medium
CN119739838A
Intelligent question answering system method for air traffic control communication business knowledge
CN120407745A
Vertical domain intelligent question answering method and system based on hierarchical labeling and screening sorting
CN120448482A
Intelligent interaction method and system based on legal consultation
CN120821838A
Retrieval method, electronic equipment, storage medium and program product
CN121412357A