Knowledge question and answer processing method and device based on large model
By collaborating with a large model and a vector knowledge base, user questions are broken down into sub-questions and answers are retrieved from the vector knowledge base. This solves the shortcomings of existing technologies in decomposing complex questions and semantic retrieval, and generates logically clear and professional knowledge-based question-and-answer results.
Patent Information
- Application Number
- CN202510960982.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-12
- Publication Date
- 2025-10-21
AI Technical Summary
Existing knowledge-based question answering technologies have shortcomings in complex question decomposition, semantic knowledge retrieval and integration, and the collaborative application of large models and professional knowledge bases, and cannot meet the requirements of accuracy, comprehensiveness and professionalism in question answering.
By employing a knowledge-based question-answering method based on a large model, user questions are assembled with prompt templates for decomposing questions to generate sub-questions. Relevant content is then retrieved from a vector knowledge base, and answers are generated using a large model. This process is iterated until a complete answer is obtained. The accuracy is verified by combining the TF-IDF algorithm and the BERT model.
It enables flexible breakdown of complex problems and accurate knowledge retrieval, generating coherent and professionally compliant answers, thereby improving the logical integrity of the question-and-answer system and user satisfaction.
Smart Images

Figure CN120822611A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of knowledge question answering technology, and in particular to a knowledge question answering processing method and device based on a large model. Background Art
[0002] With the development of natural language processing technology, knowledge question answering systems are increasingly used in scenarios such as intelligent customer service and intelligent search. Traditional knowledge question answering methods mainly rely on manually constructed rule bases and simple retrieval and matching mechanisms, which have obvious limitations:
[0003] First, when faced with complex problems, such as those involving the integration of knowledge from multiple fields and requiring step-by-step reasoning, the rule base struggles to cover all logic, effectively breaking down the problem and organizing the answer, resulting in inaccurate or incomplete answers. For example, a user asks, "Please analyze the energy conversion during the discharge process of a chemical battery based on the law of conservation of energy in physics, and explain how this principle can be used to optimize battery design in engineering applications." Traditional rules struggle to break down and answer sub-questions such as "the connotation of the law of conservation of energy," "the energy conversion path of chemical battery discharge," and "the intersection of engineering optimization and principles."
[0004] Second, traditional knowledge retrieval methods are mostly based on precise keyword matching and lack a deep understanding of semantics. When sub-questions contain synonyms or semantic extensions, it is impossible to accurately retrieve relevant content from the knowledge base. Furthermore, the ability to integrate the retrieved multi-source knowledge is weak, making it difficult to generate coherent and logical answers. For example, if the knowledge base describes relevant knowledge as "electrical energy storage," while the user's sub-question is described as "power reserve," precise matching can easily miss key information. Furthermore, if multiple aspects of knowledge are retrieved, such as battery materials, discharge principles, and energy loss, traditional methods will find it difficult to integrate and output them in an orderly manner.
[0005] Third, although large models (such as the GPT series) have demonstrated strong capabilities in language generation, when used directly for knowledge question answering, there is a problem in that the accuracy of knowledge depends on the model training data and lacks linkage with external professional knowledge bases. If the large model is allowed to generate answers independently, it may give incorrect answers or deviate from professional cognition due to untimely knowledge updates and incomplete coverage of domain knowledge. For example, the large model training data is up to a certain point in time and cannot accurately answer the latest battery technology breakthroughs; in professional engineering knowledge question answering, it is also difficult to ensure that the answers meet industry standards.
[0006] In summary, existing knowledge question answering technology has shortcomings in complex question decomposition, semantic knowledge retrieval and integration, and the collaborative application of large models and professional knowledge bases. These shortcomings make it impossible to meet the demands for accurate, comprehensive, and professional knowledge question answering in real-world scenarios. Therefore, there is an urgent need for a method that effectively leverages the language processing advantages of large models, combined with the knowledge storage and retrieval capabilities of vector knowledge bases, to optimize the entire process from question decomposition and knowledge retrieval to answer generation and aggregation, thereby improving the quality of knowledge question answering. Summary of the Invention
[0007] To this end, the present invention provides a knowledge question answering processing method and device based on a large model to solve the problem that existing knowledge question answering technology is insufficient in complex question decomposition, semantic retrieval integration, and coordination between large models and knowledge bases, and cannot meet the requirements of question answering accuracy, comprehensiveness, and professionalism.
[0008] To achieve the above objectives, the present invention provides the following technical solution: a large-model-based knowledge question answering method, comprising the following steps:
[0009] S1. Assemble the original question raised by the user and the prompt template of the decomposition question, and send it to the big model to generate the decomposition content to obtain the sub-questions;
[0010] S2. Retrieving relevant content of the sub-problems from the vector knowledge base for the decomposed sub-problems, and obtaining associated information of the sub-problems using the storage capacity of the vector knowledge base;
[0011] S3. Assemble the relevant content of the sub-question, the sub-question, and the question-answer prompt template, and send them to the big model to generate knowledge question-answer content;
[0012] S4. Repeat steps S2 and S3 until the answers to all sub-questions are obtained;
[0013] S5. Assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the main model to generate the summary answer content;
[0014] S6. Return the summarized answer content and present it to the user, completing the knowledge question and answer process.
[0015] As a preferred solution for the large-scale model-based knowledge question answering method, the original question raised by the user and the prompt template for the deconstructed question are assembled, specifically including:
[0016] According to the preset format requirements, the original question raised by the user is embedded in the prompt template of the disassembly question to form the input text for the large model disassembly question. The disassembly process adopts the text generation model:
[0017]
[0018] Where w t is the tth token generated, w t Corresponding word vector, e w ' is the word vector corresponding to token w', h t-1 is the hidden state at the previous moment, and V is the vocabulary size.
[0019] As a preferred solution for the large-model-based knowledge question answering method, the process of retrieving relevant content of the sub-question from the vector knowledge base includes:
[0020] Convert the sub-questions into vector representations and search the vector knowledge base based on vector similarity to obtain relevant content whose similarity with the sub-questions is higher than the preset threshold. The cosine similarity formula is used for similarity calculation:
[0021]
[0022] Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ||d|| represent the L2 norm of the vector respectively.
[0023] As a preferred solution for the knowledge question-answering processing method based on a large model, the question-answer prompt template contains answer format requirements and content focus prompt information for sub-questions, which is used to guide the large model to generate sub-question answers that meet expectations. The large model uses an autoregressive generation method when generating answers, and the probability model is the product of the generation probabilities of each token:
[0024]
[0025] Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
[0026] As a preferred solution for the large-scale model-based knowledge question-answering processing method, when assembling the original question, each pair of sub-questions and answers, and the summary prompt template, it also includes the step of pre-processing the answers to each sub-question, which includes deduplication, format unification, and key information extraction;
[0027] Key information extraction uses the TF-IDF algorithm, and the calculation formula is:
[0028] TF-IDF(t c ,d w )=TF(tc ,d w )×IDF(t c )
[0029]
[0030] Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents.
[0031] As a preferred solution for the knowledge question-answering processing method based on a large model, after generating the content of the summary answer, it also includes: verifying the accuracy of the summary content, and the accuracy verification includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts a BERT-based semantic similarity model, and the output is a similarity score s∈[0, 1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.
[0032] The present invention also provides a knowledge question-answering processing device based on a large model, comprising:
[0033] The question decomposition module is used to assemble the original question raised by the user with the prompt template for decomposing the question, and send it to the large model to generate the decomposition content and obtain the sub-questions;
[0034] A content retrieval module is used to retrieve the relevant content of the sub-problems obtained by disassembly from the vector knowledge base, and obtain the associated information of the sub-problems by using the storage capacity of the vector knowledge base;
[0035] The sub-question processing module is used to assemble the relevant content of the sub-question, the sub-question and the question-answer prompt template, and send them to the big model to generate the knowledge question-answer content;
[0036] A loop processing module is used to control the process of repeated content retrieval and sub-question answer generation until the answers to all sub-questions are obtained;
[0037] The answer summary module is used to assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the main model to generate the summary answer content;
[0038] The result presentation module is used to return the summarized answer content and present it to the user, completing the knowledge question and answer process.
[0039] As a preferred solution for the knowledge question-answering processing device based on a large model, the question decomposition module embeds the original question raised by the user into the prompt template of the decomposition question according to the preset format requirements, forming the input text for the large model decomposition question. The decomposition process adopts the text generation model:
[0040]
[0041] Where w t is the tth token generated, w t Corresponding word vector, e w ' is the word vector corresponding to token w', h t-1 is the hidden state at the previous moment, and V is the vocabulary size;
[0042] In the content retrieval module, the sub-questions are converted into vector representations, and a search is performed in the vector knowledge base based on vector similarity to obtain relevant content whose similarity to the sub-questions is higher than a preset threshold. The similarity is calculated using the cosine similarity formula:
[0043]
[0044] Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ||d|| represent the L2 norm of the vector respectively.
[0045] As a preferred solution for the knowledge question-answering processing device based on a large model, in the sub-question processing module, the question-answer prompt template contains the answer format requirements and content focus prompt information for the sub-questions, which is used to guide the large model to generate sub-question answers that meet the expectations. The large model uses an autoregressive generation method when generating answers, and the probability model is the product of the generation probabilities of each token:
[0046]
[0047] Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
[0048] As a preferred solution of the knowledge question answering processing device based on a large model, it also includes:
[0049] An answer preprocessing module is used to preprocess the answers to each sub-question, including deduplication, format unification, and key information extraction;
[0050] Key information extraction uses the TF-IDF algorithm, and the calculation formula is:
[0051] TF-IDF(t c ,d w )=TF(t c ,d w )×IDF(t c )
[0052]
[0053] Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents;
[0054] The accuracy verification module is used to verify the accuracy of the summarized content. The accuracy verification includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts the BERT-based semantic similarity model and outputs a similarity score s∈[0,1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.
[0055] The present invention has the following advantages:
[0056] First, through the process of user questions, prompt assembly, and sub-question decomposition by the large model, leveraging the large model's language understanding capabilities, ambiguous and complex original questions (such as those that cross multiple fields) are broken down into a sequence of clear, searchable sub-questions. Compared to traditional rule-based decomposition (which relies on manually preset logic), this approach covers more flexible question structures, making subsequent knowledge retrieval and answers more targeted, and improving the integrity of the question-answering logic from the source.
[0057] Second, the closed loop of sub-questions, vector knowledge base retrieval of relevant content, and large model generation of answers to sub-questions realizes the collaboration between the external knowledge base (professional knowledge storage) and the large model (language generation): the vector knowledge base matches precise knowledge fragments for sub-questions through semantic retrieval (avoiding the "fantasy" of the large model); the large model generates answers based on the retrieved content, which not only utilizes the professional knowledge of the knowledge base, but also uses the organizational capabilities of the language model to make the answers more coherent and in line with natural language expression.
[0058] Third, the design of looping through sub-questions and aggregating them into a final answer ensures that no sub-questions are missed. By combining the "original question + sub-question answers → large-scale model" approach, scattered sub-question answers are reassembled into a complete answer centered around the original question, avoiding fragmented answers and improving the overall logic and readability of the answers. Compared to the "mechanical splicing results" of traditional search-based question-answering, this significantly improves user comprehension efficiency and satisfaction with the answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are merely exemplary, and those skilled in the art can, without inventive effort, derive other implementation drawings based on the provided drawings.
[0060] The structures, proportions, sizes, etc. illustrated in this specification are intended solely to complement the contents disclosed herein and to facilitate understanding and reading by persons skilled in the art. They are not intended to limit the conditions under which the present invention may be implemented and therefore have no substantive technical significance. Any structural modifications, changes in proportions, or adjustments in sizes, without affecting the efficacy and objectives of the present invention, shall remain within the scope of the technical contents disclosed herein.
[0061] Figure 1 This is a flow chart of the large-model-based knowledge question-answering processing method provided in Example 1 of the present invention;
[0062] Figure 2 This is a schematic diagram of the technical route of the large-model-based knowledge question-answering processing method provided in Example 1 of the present invention;
[0063] Figure 3 This is a schematic diagram of the architecture of the knowledge question and answer processing device based on a large model provided in Example 2 of the present invention. DETAILED DESCRIPTION
[0064] The following describes the implementation of the present invention using specific embodiments. Those skilled in the art will readily understand the other advantages and benefits of the present invention from the disclosure herein. Obviously, the embodiments described are only a portion of the present invention, not all of it. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.
[0065] Example 1
[0066] See also Figure 1, an embodiment of the present invention provides a knowledge question answering processing method based on a large model, comprising the following steps:
[0067] S1. Assemble the original question raised by the user and the prompt template of the decomposition question, and send it to the big model to generate the decomposition content to obtain the sub-questions.
[0068] Specifically, the original question entered by the user may be complex or ambiguous. The prompt template is a pre-designed guidance framework that standardizes the input format and enhances the accuracy of the large model's problem analysis. After the original question is embedded in the prompt template, it forms a structured input text. Large models (such as the GPT series) use their pre-trained language understanding and generation capabilities and an autoregressive generation mechanism to generate the breakdown content word by word according to the text generation model. By calculating the generation probability of each token and combining it with the contextual semantics, the model breaks down complex questions into a logically clear sequence of sub-questions, achieving a preliminary deconstruction of the problem.
[0069] S2. For the sub-problems obtained by decomposition, relevant content of the sub-problems is retrieved from the vector knowledge base, and the associated information of the sub-problems is obtained by utilizing the storage capacity of the vector knowledge base.
[0070] Specifically, the documents stored in the vector knowledge base have been converted into vector form. For the sub-problems obtained by disassembly, they are first converted into vector representations (such as through models such as SBERT), and then retrieved based on vector similarity. The cosine similarity formula is used to calculate the similarity between the sub-problem vector and the document vector in the knowledge base. By setting a threshold, relevant content with high similarity is screened out. This vector-based retrieval method can achieve semantic matching. Compared with traditional keyword matching, it can more accurately obtain knowledge fragments related to the sub-problem, providing rich information support for subsequent answer generation.
[0071] S3. Assemble the relevant content of the sub-question, the sub-question and the question-answer prompt template, and send them to the big model to generate knowledge question-answer content.
[0072] Specifically, the retrieved sub-question-related content, the sub-question itself, and the question-and-answer prompt template are combined to form new input text. The question-and-answer prompt template includes prompts for answer format and content emphasis, guiding the large model to generate expected answers. The large model uses an autoregressive generation method to generate answers, with its probability model being the product of the generation probabilities of each token. Based on the input text and its own language generation capabilities, the large model generates answers to the sub-questions word by word according to the prompt requirements, ensuring that the answers meet the requirements in terms of content and format.
[0073] S4. Repeat steps S2 and S3 until the answers to all sub-questions are obtained.
[0074] Specifically, when there are multiple sub-questions, the search and answer generation operations must be performed sequentially for each sub-question. By looping through steps S2 and S3, each sub-question is processed one by one, ensuring that each sub-question retrieves relevant content from the vector knowledge base and the corresponding answer is generated by the large model. This looping mechanism ensures that all sub-questions are fully processed, avoiding omissions and laying the foundation for the final answer aggregation.
[0075] S5. Assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the big model to generate the summary answer content.
[0076] Specifically, after obtaining the answers to all sub-questions, the original question, each pair of sub-questions and their answers, and the summary prompt template are assembled. The summary prompt template is used to guide the large model to integrate the scattered sub-question answers into a complete and coherent answer. During the assembly process, the answers to each sub-question also need to be pre-processed, including deduplication, formatting, and key information extraction. Key information extraction uses the TF-IDF algorithm to extract key information from the answer by calculating word frequency and inverse document frequency, reducing redundant information. Then, based on this input information, the large model uses its summarization capabilities to generate a summary answer to the original question, making the answer logically clear and highlighting the key points.
[0077] S6. Return the summarized answer content and present it to the user, completing the knowledge question and answer process.
[0078] Specifically, the aggregated answers generated by the large model are appropriately processed (e.g., formatted) before being returned to the user for presentation. This completes the entire Q&A process, from user questioning to final answer feedback, allowing users to receive complete and accurate answers to their original questions, enhancing the user experience.
[0079] In this embodiment, in step S1, the original question raised by the user and the prompt template for the decomposition question are assembled, specifically including: according to the preset format requirements, the original question raised by the user is embedded in the prompt template for the decomposition question to form the input text for the large model decomposition question. The decomposition process adopts the text generation model:
[0080]
[0081] Where w t is the tth token generated, w t Corresponding word vector, e wis the word vector corresponding to token w°, h t-1 is the hidden state at the previous moment, and V is the vocabulary size.
[0082] Specifically, in natural language processing, text is usually split into tokens (such as words, subwords, etc.) for processing. It is a representation that maps tokens to high-dimensional vector space to capture the semantic information of tokens. Hidden state (h t-1 ) is the intermediate state maintained by the large model when processing sequence data, which contains the context information of the previous input. The text generation model calculates the current token (w t ) with the hidden state at the previous moment, exponentially transforming the result. The result is then normalized with the corresponding values of all tokens in the vocabulary to obtain the probability of generating the tth token given the previous t-1 tokens. This method generates word-by-word breakdowns, ensuring that the generated sub-questions are semantically consistent with the original question and meet the requirements of logical breakdown.
[0083] In this embodiment, in step S2, the process of retrieving the relevant content of the sub-question from the vector knowledge base includes:
[0084] Convert the sub-questions into vector representations and search the vector knowledge base based on vector similarity to obtain relevant content whose similarity with the sub-questions is higher than the preset threshold. The cosine similarity formula is used for similarity calculation:
[0085]
[0086] Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ‖d‖ represent the L2 norm of the vector respectively.
[0087] Specifically, in vector space, the cosine similarity of two vectors can measure their directional similarity, thereby reflecting semantic relevance. After converting both the sub-question and the knowledge base document into vectors, the degree of relevance between the document and the sub-question can be determined by calculating their cosine similarity. The numerator is the dot product of the two vectors, reflecting their degree of similarity; the denominator is the product of the L2 norm of the two vectors, used for normalization. When the similarity is higher than the preset threshold, the document is considered to be relevant to the sub-question and is retrieved. This retrieval method can effectively handle semantic phenomena such as synonyms and antonyms, improve retrieval accuracy and recall, and provide more relevant knowledge content for the sub-question.
[0088] In this embodiment, in step S3, the question-answer prompt template includes answer format requirements and content emphasis prompt information for sub-questions, which are used to guide the large model to generate expected sub-question answers. The large model uses an autoregressive generation method when generating answers, and the probability model is the product of the generation probabilities of each token:
[0089]
[0090] Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
[0091] Specifically, autoregressive generation means that when generating text, the large model generates each token sequentially, with the generation of each token based on all previously generated tokens. This probabilistic model represents the generation probability of the entire answer sequence as the product of the generation probabilities of each token, reflecting the sequential dependency of answer generation. The format requirements and content emphasis information in the question-and-answer prompt template serve as additional input conditions, influencing the large model's calculation of the generation probability of each token, thereby guiding the large model to generate answers that meet the requirements. This approach ensures that the generated answers to sub-questions are standardized in format and focused in content, meeting the needs of practical applications.
[0092] In this embodiment, in step S5, when assembling the original question, each pair of sub-questions and answers with the summary prompt template, the step of pre-processing the answers to each sub-question is also included. The pre-processing includes deduplication, format unification, and key information extraction.
[0093] Key information extraction uses the TF-IDF algorithm, and the calculation formula is:
[0094] TF-IDF(t c ,d w )=TF(t c ,d w )×IDF(t c )
[0095]
[0096] Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents.
[0097] Specifically, the answers to sub-questions may contain duplicate content, inconsistent formats, or contain a large amount of redundant information. The preprocessing step is used to clean and organize the answers. Deduplication can eliminate duplicate information, and the unified format makes the answers more neat and standardized in presentation. Key information extraction uses the TF-IDF algorithm, which measures the importance of a word in a document by combining term frequency (TF) and inverse document frequency (IDF). Term frequency indicates the frequency of a word appearing in a document, and inverse document frequency reflects the rarity of the word in the entire knowledge base. The higher the TF-IDF value, the more important the word is in the document. By extracting words with high TF-IDF values as key information, redundant information can be effectively filtered out, the core content of the answer can be retained, and high-quality input can be provided for subsequent summary generation.
[0098] In a possible embodiment, after generating the content of the summary answer, it also includes: verifying the accuracy of the summary content, wherein the accuracy verification includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts a BERT-based semantic similarity model, and the output is a similarity score s∈[0,1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.
[0099] Specifically, in order to ensure that the generated summary answer content is accurate and reliable, accuracy verification is required. The consistency comparison with the content in the vector knowledge base is to check whether the summary answer is consistent with the professional knowledge in the knowledge base to avoid knowledge errors. The BERT-based semantic similarity model can calculate the similarity between the summary content and the documents in the knowledge base from a semantic level, and the output similarity score can quantify this consistency. The logical rationality check is to analyze the logical structure of the summary answer to ensure that the answer is logically coherent and reasonable, without contradictions or jumps. By setting a preset threshold, the similarity score is judged. When the score is higher than the threshold, the summary content is considered to be consistent with the knowledge base content, ensuring the accuracy and reliability of the answer.
[0100] See also Figure 2 , an application process of an embodiment of the present invention is as follows:
[0101] 1. Process start: user question input
[0102] Application service layer - knowledge question and answer: As the starting point of user interaction, it receives the original question input by the user (such as "Explain the energy conversion principle of chemical battery discharge"), passes the question to the algorithm service layer, and triggers the knowledge question and answer process.
[0103] 2. Algorithm Service Layer: Overall Problem Analysis
[0104] After receiving user questions, the algorithm service layer calls a large model (such as GPT) and, combined with a preset "decomposition prompt" (such as "split the question into 2-3 ordered sub-questions"), breaks down complex questions into a sequence of sub-questions (for example, "What is the chemical reaction in a chemical battery discharge?" and "How is energy converted in the reaction?"). This transforms the vague and complex original question into clear, step-by-step sub-questions, laying the foundation for accurate answers.
[0105] 3. Sub-problem handling: RAG process
[0106] Taking the sub-question RAG process as an example, after the sub-question is generated, the "knowledge vector library retrieval" is triggered. The system converts the sub-question into a vector (such as using the SBERT model to encode semantics) and matches semantically related knowledge fragments in the vector knowledge base (such as professional documents in the battery field and academic paper abstracts). The "retrieved knowledge fragment + sub-question" is assembled into a new prompt (such as "Combining the following knowledge fragments, answer the sub-question: {knowledge fragment} {sub-question}"), and the large model is called again to generate the answer to the sub-question (such as deriving the "energy conversion path of the discharge reaction" based on the knowledge fragment).
[0107] If there are multiple sub-questions (sub-question 1, sub-question 2, etc.), execute the "search → generate answer" process in sequence to ensure that each sub-question receives a professional and accurate response.
[0108] IV. Summary of the overall question: integrated answers
[0109] After collecting the answers to all the sub-questions, the algorithm service layer assembles the "original question + sub-question answers + summary prompt" (e.g., "Integrate the sub-question answers to produce a complete, coherent answer around the original question") and calls the main model a third time. Based on this information, the main model reorganizes the scattered sub-answers into a complete, coherent summary answer that aligns with the original question (e.g., concatenating the sub-answers to provide logical connections to form a complete explanation of "first discussing the reaction, then the energy conversion").
[0110] 5. Result Output: Feedback to Users
[0111] The algorithm service layer returns the "aggregated answer" to the application service layer, and finally presents it to the user through the "result display" module (such as web interface, APP pop-up window), completing the entire knowledge question and answer process.
[0112] The application scenarios of the present invention are as follows:
[0113] Scenario 1: Intelligent Customer Service and After-Sales Support
[0114] Scenario description: The enterprise customer service system is connected to this knowledge question and answer solution to handle user product inquiries, troubleshooting, after-sales policy issues, etc.
[0115] Adaptation logic:
[0116] Complex problem decomposition: Split users' mixed questions of "product error code + usage scenario + demand" (e.g., "My phone displays error E12 while charging. I just upgraded the system. Is it covered by warranty?") into sub-questions such as "What fault does the E12 error correspond to?" and "Does the system upgrade affect the warranty?"
[0117] Knowledge retrieval: Retrieve relevant content from the enterprise knowledge base (including fault manuals and warranty policy documents);
[0118] Value: Replaces 70%-80% of repetitive questions and answers of manual customer service, responds to complex questions in seconds, reduces labor costs, and improves after-sales satisfaction.
[0119] Scenario 2: Online Education and Q&A Tutoring
[0120] Scenario description: The education platform is used for subject question answering (such as comprehensive math, physics, and chemistry questions, and historical essay questions) and vocational skills training (such as programming and legal practice), providing students / trainees with problem-solving ideas and knowledge expansion.
[0121] Adaptation logic:
[0122] Sub-problem breakdown: Split "Analyze the principle of roller coaster motion by combining Newton's laws and conservation of energy" into sub-problems such as "Application of Newton's laws to curved motion" and "How is conservation of energy reflected";
[0123] Knowledge retrieval: related textbook knowledge points, problem-solving templates, and expanded case library;
[0124] Value: Covering all stages of K12 and vocational education, it helps teachers reduce their workload and provides students with personalized tutoring with "layered decomposition, step-by-step explanation, summary and expansion".
[0125] Scenario 3: Intelligent Search and Information Aggregation Platform
[0126] Scenario description: In a vertical search engine (such as academic search or industry report platform), a user enters a complex query (such as "the impact of new energy vehicle battery technology breakthroughs on the charging pile industry and market size forecast in 2025"), and the system outputs an integrated answer.
[0127] Adaptation logic:
[0128] Sub-problem decomposition: divided into sub-problems such as "battery technology breakthroughs", "charging pile adaptation demand changes", and "market scale model derivation";
[0129] Knowledge retrieval: crawling academic papers, industry reports, and market data;
[0130] Value: It replaces the “link aggregation” of traditional search and directly outputs the conclusion of “structured analysis + data support”, allowing users to skip the process of “filtering information and piecing together answers”.
[0131] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario, where multiple devices cooperate with each other to complete the method. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the large model-based knowledge question answering method.
[0132] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0133] Example 2
[0134] See also Figure 3 Embodiment 2 of the present invention further provides a knowledge question-answering processing device based on a large model, comprising:
[0135] The question decomposition module 100 is used to assemble the original question raised by the user and the prompt template for decomposing the question, and send it to the large model to generate decomposition content to obtain sub-questions;
[0136] A content retrieval module 200 is configured to retrieve relevant content of the sub-problems obtained by decomposition from a vector knowledge base, and obtain associated information of the sub-problems by utilizing the storage capacity of the vector knowledge base;
[0137] The sub-question processing module 300 is used to assemble the relevant content of the sub-question, the sub-question and the question-answer prompt template, and send them to the big model to generate the knowledge question-answer content;
[0138] A loop processing module 400 is used to control the process of repeated content retrieval and sub-question answer generation until answers to all sub-questions are obtained;
[0139] The answer summary module 500 is used to assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the main model to generate the summary answer content;
[0140] The result presentation module 600 is used to return the summary answer content and present it to the user, completing the knowledge question answering process.
[0141] In this embodiment, the question decomposition module 100 embeds the original question raised by the user into the prompt template for decomposing the question according to the preset format requirements, forming the input text for decomposing the question of the large model. The decomposition process adopts the text generation model:
[0142]
[0143] Where w t is the tth token generated, w t Corresponding word vector, e w ' is the word vector corresponding to token w', h t-1 is the hidden state at the previous moment, and V is the vocabulary size;
[0144] In the content retrieval module 200, the sub-questions are converted into vector representations, and a search is performed in the vector knowledge base based on vector similarity to obtain relevant content whose similarity to the sub-questions is higher than a preset threshold. The similarity is calculated using the cosine similarity formula:
[0145]
[0146] Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ||d|| represent the L2 norm of the vector respectively.
[0147] In this embodiment, in the sub-question processing module 300, the question-answer prompt template includes answer format requirements and content emphasis prompt information for the sub-questions, which is used to guide the large model to generate expected sub-question answers. The large model uses an autoregressive generation method when generating answers, and the probability model is the product of the generation probabilities of each token:
[0148]
[0149] Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
[0150] In this embodiment, it also includes:
[0151] An answer preprocessing module 700 is used to preprocess the answers to each sub-question, including deduplication, format unification, and key information extraction;
[0152] Key information extraction uses the TF-IDF algorithm, and the calculation formula is:
[0153] TF-IDF(t c ,d w )=TF(t c ,d w )×IDF(t c )
[0154]
[0155] Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents;
[0156] The accuracy verification module 800 is used to verify the accuracy of the summarized content. The accuracy verification includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts a BERT-based semantic similarity model and the output is a similarity score s∈[0, 1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.
[0157] It should be noted that the information interaction, execution process, etc. between the modules of the above-mentioned device are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown above in the present application, and will not be repeated here.
[0158] Example 3
[0159] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which the program code of the knowledge question and answer processing method based on a large model is stored. The program code includes instructions for executing the knowledge question and answer processing method based on a large model of embodiment 1 or any possible implementation thereof.
[0160] Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
[0161] Example 4
[0162] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0163] The processor and the memory communicate with each other through a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the large-model-based knowledge question-answering processing method of Example 1 or any possible implementation thereof.
[0164] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor, which is implemented by reading software code stored in a memory. The memory can be integrated into the processor or located outside the processor and exist independently.
[0165] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode.
[0166] Obviously, those skilled in the art will appreciate that the various modules or steps of the present invention described above can be implemented using a general-purpose computing device, centralized on a single computing device, or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computing device, which can then be stored in a storage device and executed by the computing device. In some cases, the steps shown or described can be performed in a different order than that shown, or can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0167] Although the present invention has been described in detail above using general descriptions and specific embodiments, it will be apparent to those skilled in the art that modifications and improvements may be made thereto. Therefore, such modifications and improvements, without departing from the spirit of the present invention, are intended to be within the scope of protection claimed herein.
Claims
1. A knowledge question answering method based on a large model, characterized by: The following steps are involved: S1. Assemble the original question raised by the user and the prompt template of the decomposition question, and send it to the big model to generate the decomposition content to obtain the sub-questions; S2. Retrieving relevant content of the sub-problems from the vector knowledge base for the decomposed sub-problems, and obtaining associated information of the sub-problems using the storage capacity of the vector knowledge base; S3. Assemble the relevant content of the sub-question, the sub-question, and the question-answer prompt template, and send them to the big model to generate knowledge question-answer content; S4. Repeat steps S2 and S3 until the answers to all sub-questions are obtained; S5. Assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the main model to generate the summary answer content; S6. Return the summarized answer content and present it to the user, completing the knowledge question and answer process.
2. The large model-based knowledge question answering method according to claim 1, characterized in that: The assembly of the original question raised by the user and the prompt template for breaking down the question specifically includes: According to the preset format requirements, the original question raised by the user is embedded in the prompt template of the disassembly question to form the input text for the large model disassembly question. The disassembly process adopts the text generation model: Where w t is the tth token generated, w t Corresponding word vector, e w ' is the corresponding token w 'word vector, h t-1 is the hidden state at the previous moment, and V is the vocabulary size.
3. The large model-based knowledge question answering method according to claim 1, characterized in that: The process of retrieving the relevant content of the sub-problem from the vector knowledge base includes: Convert the sub-questions into vector representations and search the vector knowledge base based on vector similarity to obtain relevant content whose similarity with the sub-questions is higher than the preset threshold. The cosine similarity formula is used for similarity calculation: Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ||d|| represent the L2 norm of the vector respectively.
4. The method for processing knowledge questions and answers based on a large model according to claim 1, characterized in that: The question-answer prompt template contains answer format requirements and content emphasis prompts for sub-questions, which are used to guide the large model to generate expected sub-question answers. The large model uses autoregressive generation when generating answers, and the probability model is the product of the generation probabilities of each token: Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
5. The method for processing knowledge questions and answers based on a large model according to claim 1, characterized in that: When assembling the original question, each pair of sub-questions and answers, and the summary prompt template, the steps of pre-processing the answers to each sub-question are also included, wherein the pre-processing includes deduplication, format unification, and key information extraction; Key information extraction uses the TF-IDF algorithm, and the calculation formula is: TF-IDF(t c ,d w )=TF(t c ,d w )×IDF(t c ) Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents.
6. The large model-based knowledge question answering method according to claim 1, characterized in that: After generating the content of the summary answer, it also includes: verifying the accuracy of the summary content, which includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts a BERT-based semantic similarity model, and the output is a similarity score s∈[0, 1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.
7. A knowledge question answering device based on a large model, characterized in that: include: The question decomposition module is used to assemble the original question raised by the user with the prompt template for decomposing the question, and send it to the large model to generate the decomposition content and obtain the sub-questions; A content retrieval module is used to retrieve the relevant content of the sub-problems obtained by disassembly from the vector knowledge base, and obtain the associated information of the sub-problems by using the storage capacity of the vector knowledge base; The sub-question processing module is used to assemble the relevant content of the sub-question, the sub-question and the question-answer prompt template, and send them to the big model to generate the knowledge question-answer content; A loop processing module is used to control the process of repeated content retrieval and sub-question answer generation until the answers to all sub-questions are obtained; The answer summary module is used to assemble the original question, each pair of sub-questions and answers, and the summary prompt template, and send them to the main model to generate the summary answer content; The result presentation module is used to return the summarized answer content and present it to the user, completing the knowledge question and answer process.
8. The knowledge question answering device based on a large model according to claim 7 is characterized in that: In the problem disassembly module, the original question raised by the user is embedded into the prompt template of the disassembly problem according to the preset format requirements, forming the input text for the large model disassembly problem. The disassembly process adopts the text generation model: Where w t is the tth token generated, w t Corresponding word vector, e w ' is the corresponding token w 'word vector, h t-1 is the hidden state at the previous moment, V is the vocabulary size; In the content retrieval module, the sub-questions are converted into vector representations, and a search is performed in the vector knowledge base based on vector similarity to obtain relevant content whose similarity to the sub-questions is higher than a preset threshold. The similarity is calculated using the cosine similarity formula: Where q is the subproblem vector, i.e., the numerical representation of the subproblem; d is the knowledge base document vector, i.e., the numerical representation of the document; ||q|| and ||d|| represent the L2 norm of the vector respectively.
9. The knowledge question answering device based on a large model according to claim 7, characterized in that: In the sub-question processing module, the question-answer prompt template contains the answer format requirements and content focus prompt information for the sub-questions, which is used to guide the large model to generate the expected sub-question answers. The large model uses autoregressive generation when generating answers, and the probability model is the product of the generation probabilities of each token: Where n is the length of the answer, w1 to w n is the generated answer text sequence, P(w t |w1,...,w t-1 ) is the conditional probability of generating the tth token when the previous t-1 tokens are known.
10. The knowledge question answering device based on a large model according to claim 7, characterized in that: Also includes: An answer preprocessing module is used to preprocess the answers to each sub-question, including deduplication, format unification, and key information extraction; Key information extraction uses the TF-IDF algorithm, and the calculation formula is: TF-IDF(t c ,d w )=TF(t c ,d w )×IDF(t c ) Where, TF(t c ,d w ) is the word t c In the document d w The word frequency in, N is the total number of documents, df(t c ) contains the word t c The number of documents; The accuracy verification module is used to verify the accuracy of the summarized content. The accuracy verification includes consistency comparison with the content in the vector knowledge base and logical rationality check. The consistency comparison adopts the BERT-based semantic similarity model and outputs a similarity score s∈[0,1], where 0 indicates complete dissimilarity and 1 indicates complete similarity. The consistency is judged by a preset threshold.