A real-time question answering method based on large language model

By building a real-time Q&A model, including answer generation, interpretation text generation and authenticity verification modules, the problems of insufficient answer interpretability and authenticity verification in traditional Q&A methods are solved, and more accurate and credible Q&A effects are achieved .

CN118966166BActive Publication Date: 2024-12-27HECHEN ZONGHENG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411426186.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2024-12-27
Estimated Expiration
2044-10-14

AI Technical Summary

Technical Problem

The answers generated by traditional Q&A based on large language models are insufficiently interpretable, cannot provide detailed interpretable text, and lack effective mechanisms to verify the authenticity of the answer, which can easily mislead users.

Method used

Build a real-time Q&A model, including answer generation module, interpretation text generation module and authenticity verification module, preprocessing problem data, generate question answers and provide explanation text, calculate answer confidence, and train the model using incremental learning method. Use the weighted fusion of character vectors, word vectors and sentence vectors to generate answers in combination with extracted formulas and generative models, and extract question-and-answer correlation features through the RoBERTa model.

Benefits of technology

It improves the interpretability and trust of answers, enhances the model's ability to understand complex problems, ensures the accuracy and authenticity of answers, and reduces the user's reading burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118966166B_ABST
    Figure CN118966166B_ABST
Patent Text Reader

Abstract

The present invention discloses a real-time question-answering method based on a large language model, comprising: S1: collecting question data and performing format conversion, word segmentation, and stop word removal, and copying the formula in the question data to the end of the question data separately to obtain the preprocessed question data; S2: constructing a real-time question-answering model, the real-time question-answering model comprising an answer generation module, an explanation text generation module, and an authenticity verification module; and in the answer generation module of the real-time question-answering model, generating a question answer based on the preprocessed question data; S3: generating an explanation text based on the preprocessed question data and the question answer; S4: calculating the answer confidence based on the preprocessed question data, the question answer, and the explanation text; S5: training the real-time question-answering model by using an incremental learning method. The present invention aims to solve the problem that the answers generated by the traditional question-answering method are insufficiently interpretable and inconsistent with objective facts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of online education technology, and in particular to a real-time question-answering method based on a large language model. Background Art

[0002] The real-time question answering method based on large language models refers to the use of pre-trained large language models, such as the GPT series, BERT, etc. By inputting the user's questions, the model can quickly understand the context of the question, analyze relevant information in its huge knowledge base, and finally generate an answer and return it to the user.

[0003] Traditional question-answering methods mainly rely on keyword matching and rule engines; keyword matching is to match the keywords in the question with a pre-set keyword library, find the closest question template and return the preset answer. This method is simple to implement, but is limited by the completeness and accuracy of the keyword library and is difficult to handle complex and changeable questions; the rule engine uses a series of preset rules and logic to determine the type and intent of the question, and generates corresponding answers based on the rules; this method requires a large number of manual rules, is costly and difficult to cover all situations.

[0004] Although traditional methods have met the needs of answering questions to a certain extent, they are still insufficient in the interpretability of answers. They are unable to provide detailed explanatory text like humans to explain the reasoning process of the answers, which reduces users' trust in the answers, especially in situations where they need to have an in-depth understanding of the background of the question. In addition, although large language models have a strong ability to generate answers, they also face the problem of "hallucination", that is, the model may generate answers that seem reasonable but are actually inconsistent with the facts. In the process of generating answers, traditional large models lack an effective mechanism to verify the authenticity of the answers, which can easily mislead users. Summary of the invention

[0005] In view of this, the present invention aims to provide a real-time question answering method based on a large language model, aiming to solve the problem that the answers generated by traditional question answering methods are not interpretable enough and are inconsistent with objective facts.

[0006] A real-time question answering method based on a large language model comprises the following steps:

[0007] S1: Collect question data and perform format conversion, word segmentation, and stop word removal, and copy the formula in the question data to the end of the question data to obtain the preprocessed question data;

[0008] S2: constructing a real-time question-answering model, the real-time question-answering model comprising an answer generation module, an explanation text generation module, and an authenticity verification module; and in the answer generation module of the real-time question-answering model, generating a question answer based on the preprocessed question data;

[0009] S3: In the explanation text generation module of the real-time question answering model, an explanation text is generated based on the preprocessed question data and the question answer;

[0010] S4: In the authenticity verification module of the real-time question answering model, the confidence of the answer is calculated based on the preprocessed question data, the answer to the question and the explanation text;

[0011] S5: Use incremental learning to train the real-time question-answering model.

[0012] Furthermore, the step S1 collects the question data and performs format conversion, word segmentation, and stop word removal, and copies the formula in the question data to the end of the question separately to obtain the preprocessed question data, including:

[0013] S11: Collect question data, where the question data is a question sentence or a declarative sentence text expressed in a natural language, including multiple words, phrases, sentences and formulas; and convert the question data into a JSON format to obtain question data in a JSON format;

[0014] S12: Use the jieba word segmentation tool to perform word segmentation on the question data in json format to obtain the question data after word segmentation; the jieba word segmentation tool is a widely used Chinese text word segmentation library written in Python;

[0015] S13: Use the jieba word segmentation tool to traverse the question data after word segmentation, delete the stop words in the jieba stop word list, and obtain the question data after deleting the stop words; then copy the formula in the question data after deleting the stop words to the end of the question data separately to obtain the preprocessed question data.

[0016] Furthermore, in the S2 step, the answer generation module calculates the question feature vector based on the preprocessed question data through the question feature extraction part, and then generates the question answer; the explanation text generation module calculates the question-answer correlation feature and generates the explanation text according to the preprocessed question data and the question answer; the authenticity verification module calculates the answer confidence feature vector according to the preprocessed question data, the question answer and the explanation text, and then calculates the answer confidence according to the answer confidence feature vector.

[0017] Furthermore, in the step S2, in the answer generation module of the real-time question answering model, the answer to the question is generated based on the preprocessed question data, including:

[0018] S21: The answer generation module includes a question feature extraction part and an answer generation part; the question feature vector is calculated by the question feature extraction part, and the calculation method is:

[0019] ;

[0020] ;

[0021] ;

[0022] ;

[0023] ;

[0024] in, is a character vector, for Network operations, is the preprocessed problem data, is the word vector, is the sentence vector, for Pre-trained language model operations, is the semantic feature vector, is the character weight, is the word weight, is the sentence weight, is the formula vector, The formula that is copied to the end of the problem data separately in the preprocessed problem data. is the problem feature vector, Operate for multi-layer perceptron; The network, the full name of which is Character-level Convolutional Networks, is a character-level convolutional neural network model; The pre-trained language model, RoBERTa (A Robustly Optimized BERT Pretraining Approach), is a pre-trained language model that is an improved version of the BERT (Bidirectional Encoder Representations from Transformers) model.

[0025] When dealing with questions containing professional terms or mathematical formulas, it is necessary to have a deep understanding of these elements. However, most traditional feature extraction methods only rely on word vectors or sentence vectors, ignoring the importance of character-level information and formulas, which in turn causes the model to be unable to accurately capture the nuances in the question and give wrong answers. The present invention uses the weighted fusion of character vectors, word vectors and sentence vectors, as well as the introduction of formula vectors, to jointly form a rich question feature vector. This multi-dimensional and multi-level feature extraction method helps the model to more comprehensively understand the semantics and contextual information of the question. The question feature vector is also the basis for subsequent answer generation and explanation text generation.

[0026] S22: Generate the answer to the question through the answer generation part, and the calculation method is:

[0027] ;

[0028] ;

[0029] ;

[0030] like ,but:

[0031] ;

[0032] like ,but:

[0033] ;

[0034] in, Extract sequence features for the answer, for Network operations, Generate sequence features for the answer, Extract scores for answers, is a gated recurrent unit operation, To answer the question, for Model operation; UniLM model, full name Unified Language Model Pre-training, is a pre-training language model proposed by Microsoft Research based on BERT, also known as the unified pre-training language model;

[0035] Real-time question answering requires that the model generates accurate answers that are consistent with the facts. Traditional question answering methods often rely on a single answer generation strategy and use only extractive or generative models, which cannot guarantee the accuracy and pertinence of the generated answers at the same time. The answers generated in this step directly affect the effect of subsequent explanation text generation, so the quality of answer generation is particularly important. Step S22 introduces the idea of ​​"extractive + generative", combining the PointerNet network and the UniLM model to generate answers. The PointerNet network is used to extract answer-related sequence features from questions. The answer extraction sequence features are scored by the gated recurrent unit (GRU). When the extracted sequence is found to be close to the answer, it is input into the UniLM model, and the UniLM model generates answers based on these features and the semantics of the question. For questions that have never appeared in the answer library, the answer extraction score will be lower, and the extracted sequence will not participate in the subsequent generation process of the UniLM model to avoid introducing interference.

[0036] S23: Input the pre-processed question data into the answer generation module to generate the answer to the question.

[0037] Furthermore, the step S3 generates an explanation text in the explanation text generation module of the real-time question answering model according to the preprocessed question data and the question answer, including:

[0038] S31: In the explanation text generation module of the real-time question answering model, the question-answering correlation feature is calculated based on the preprocessed question data and the question answer. The calculation method is:

[0039] ;

[0040] ;

[0041] ;

[0042] ;

[0043] ;

[0044] in, is the answer word vector, is the answer sentence vector, is the answer feature vector, is the answer word vector weight, is the answer sentence vector weight, is the character-independent problem feature vector, Score the relevance of questions and answers, For modulus length operation, is the question-answer relevance feature;

[0045] S32: Generate explanation text based on question-answer correlation features. The calculation method is:

[0046] ;

[0047] in, To explain the text.

[0048] In the real-time question-answering system, since the answers to questions are generated by artificial intelligence rather than by professional subject teachers, there may be errors in the answers. In view of this feature, the present invention adopts a method of generating explanation texts to assist users in understanding the origin of the answers. Traditional methods ignore this step, and users need to read the answers carefully to find out whether the answers are correct or not. The present invention first extracts the word vectors and sentence vectors of the answers through the RoBERTa model, and weightedly fuses them to obtain the answer feature vector. Then, the correlation score between the question and the answer is calculated by combining the character-independent question feature vectors, and then generates the explanation text.

[0049] When calculating the relevance score between questions and answers, since only the relevance features of questions and answers need to be calculated and the precise understanding of the meaning of specific characters is not involved, the model needs to focus more on overall logical judgment; and character-level information is often more specific and detailed, while word vectors and sentence vectors can capture more abstract and general semantic features. Therefore, the character-level word embedding vectors are eliminated in this step to improve the generalization ability of the model.

[0050] Furthermore, the step S4 calculates the answer confidence in the authenticity verification module of the real-time question answering model according to the preprocessed question data, the question answer and the explanation text, including:

[0051] S41: In the authenticity verification module of the real-time question answering model, the answer confidence feature vector is calculated based on the preprocessed question data, the question answer and the explanation text. The calculation method is:

[0052] ;

[0053] in, is the answer confidence feature vector;

[0054] S42: Calculate the answer confidence according to the answer confidence feature vector, and the calculation method is:

[0055] ;

[0056] in, Confidence of the answer.

[0057] In order to ensure the authenticity of the answer, in addition to generating an explanatory text, it is also necessary to quantify the authenticity in the form of a score to help users save reading time; therefore, the present invention utilizes an authenticity verification module, combines the preprocessed question data, the question answer and the explanatory text to extract the answer confidence feature vector, and calculates the answer confidence.

[0058] Furthermore, the step S5 adopts an incremental learning method to train the real-time question answering model, including:

[0059] S51: iCaRL is selected as the incremental learning framework, and the learning rate is set to 0.001, the number of iterations is set to 20, and the weight of the real-time question answering model is loaded;

[0060] S52: Freeze all layers before the last three layers of the real-time question answering model, start real-time question answering model training, and use ReduceLROnPlateau to adaptively adjust the learning rate;

[0061] S53: If the accuracy of the real-time question answering model is improved after the training is completed compared to before the training, the updated real-time question answering model weight and configuration information are saved;

[0062] S54: If the accuracy of the real-time question answering model decreases after training compared to before training, the model weights and configuration information are not updated, and the learning rate is halved and training is performed again.

[0063] Compared with the prior art, the advantages of the present invention are:

[0064] (1) The present invention abandons the traditional hard-coded rules and uses the language understanding and generation capabilities of the large language model to input the processed questions into the large language model to generate answers to the questions. The present invention also generates explanatory text based on the questions and answers, and gives the confidence of the answers, thereby enhancing the interpretability of the answers to the questions and improving the overall question-answering effect.

[0065] (2) The present invention constructs a real-time question-answering model, including an answer generation module, an explanation text generation module, and an authenticity verification module. In order to answer questions containing professional terms or mathematical formulas, the answer generation module of the present invention performs weighted fusion of character vectors, word vectors, and sentence vectors, and constructs a formula vector, which together constitute a question feature vector, thereby enhancing the question understanding ability of the real-time question-answering model.

[0066] (3) In the real-time question-answering scenario, in order to address the problem of factual accuracy of the generative model, the present invention introduces the idea of ​​"extractive + generative" and combines the PointerNet network and the UniLM model to generate answers. First, the extractive model PointerNet network is used to extract the sequence features related to the answer; then the score of the extracted sequence features is calculated. When it is found that the extracted sequence is close to the answer, it is input into the generative model UniLM, and the UniLM model generates the answer with reference to these sequence features; for questions that have never appeared in the answer library, the extracted sequence is discarded, and the model's logical understanding and generation capabilities are used to directly generate answers to avoid introducing interference. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 A schematic diagram of the process of real-time question answering based on a large language model provided by the present invention;

[0068] Figure 2 A schematic diagram of the algorithm flow of the question answer generation module provided by the present invention;

[0069] Figure 3 A schematic diagram of the algorithm flow for generating the interpretation text provided by the present invention;

[0070] Figure 4 A schematic diagram of the algorithm flow of the optimized authenticity verification provided by the present invention. DETAILED DESCRIPTION

[0071] The present invention is further described below in conjunction with the accompanying drawings, but the present invention is not limited in any way. Any changes or substitutions made based on the teachings of the present invention belong to the protection scope of the present invention.

[0072] Embodiment: A real-time question answering method based on a large language model, such as Figure 1 As shown, the following steps are included:

[0073] S1: Collect question data and perform format conversion, word segmentation, and stop word removal, and copy the formula in the question data to the end of the question data to obtain the preprocessed question data;

[0074] S11: Collect question data, where the question data is a question sentence or a declarative sentence text expressed in a natural language, including multiple words, phrases, sentences and formulas; and convert the question data into a JSON format to obtain question data in a JSON format;

[0075] S12: Use the jieba word segmentation tool to perform word segmentation on the question data in json format to obtain the question data after word segmentation;

[0076] S13: Use the jieba word segmentation tool to traverse the question data after word segmentation, delete the stop words in the jieba stop word list, and obtain the question data after deleting the stop words; then copy the formula in the question data after deleting the stop words to the end of the question data separately to obtain the preprocessed question data.

[0077] S2: construct a real-time question-answering model, which includes an answer generation module, an explanation text generation module, and an authenticity verification module; and in the answer generation module of the real-time question-answering model, generate a question answer based on the preprocessed question data; Figure 2 As shown;

[0078] The answer generation module calculates the question feature vector based on the preprocessed question data through the question feature extraction part, and then generates the question answer; the explanation text generation module calculates the question-answer correlation feature and generates the explanation text according to the preprocessed question data and the question answer; the authenticity verification module calculates the answer confidence feature vector according to the preprocessed question data, the question answer and the explanation text, and then calculates the answer confidence according to the answer confidence feature vector.

[0079] In step S2, in the answer generation module of the real-time question answering model, based on the preprocessed question data, the question answer is generated, including:

[0080] S21: The answer generation module includes a question feature extraction part and an answer generation part; the question feature vector is calculated by the question feature extraction part, and the calculation method is:

[0081] ;

[0082] ;

[0083] ;

[0084] ;

[0085] ;

[0086] in, is a character vector, for Network operations, is the preprocessed problem data, is the word vector, is the sentence vector, for Pre-trained language model operations, is the semantic feature vector, is the character weight, is the word weight, is the sentence weight, is the formula vector, The formula that is copied to the end of the problem data separately in the preprocessed problem data. is the problem feature vector, Operate for multi-layer perceptron;

[0087] When dealing with questions containing professional terms or mathematical formulas, it is necessary to have a deep understanding of these elements. However, most traditional feature extraction methods only rely on word vectors or sentence vectors, ignoring the importance of character-level information and formulas, which in turn causes the model to be unable to accurately capture the nuances in the question and give wrong answers. The present invention uses the weighted fusion of character vectors, word vectors and sentence vectors, as well as the introduction of formula vectors, to jointly form a rich question feature vector. This multi-dimensional and multi-level feature extraction method helps the model to more comprehensively understand the semantics and contextual information of the question. The question feature vector is also the basis for subsequent answer generation and explanation text generation.

[0088] S22: Generate the answer to the question through the answer generation part, and the calculation method is:

[0089] ;

[0090] ;

[0091] ;

[0092] like ,but:

[0093] ;

[0094] like ,but:

[0095] ;

[0096] in, Extract sequence features for the answer, for Network operations, Generate sequence features for the answer, Extract scores for answers, is a gated recurrent unit operation, To answer the question, for Model operation;

[0097] Real-time question answering requires that the model generate accurate answers that are consistent with the facts. Traditional question answering methods often rely on a single answer generation strategy and only use extractive or generative models, which cannot guarantee the accuracy and pertinence of the generated answers at the same time. The answers generated in this step directly affect the effect of subsequent explanatory text generation, and the quality of answer generation is particularly important. Step S22 introduces the "extractive + generative" approach, combining the PointerNet network and the UniLM model to generate answers. The PointerNet network is used to extract answer-related sequence features from questions. The answer extraction sequence features are scored by the gated recurrent unit (GRU). When the extracted sequence is found to be close to the answer, it is input into the UniLM model, and the UniLM model generates answers based on these features and the semantics of the question. For questions that have never appeared in the answer library, the answer extraction score will be lower, and the extracted sequence will not participate in the subsequent UniLM model generation process to avoid interference.

[0098] S23: Input the pre-processed question data into the answer generation module to generate the answer to the question.

[0099] S3: In the explanation text generation module of the real-time question answering model, the explanation text is generated based on the preprocessed question data and the question answer, such as Figure 3 As shown;

[0100] S31: In the explanation text generation module of the real-time question answering model, the question-answering correlation feature is calculated based on the preprocessed question data and the question answer. The calculation method is:

[0101] ;

[0102] ;

[0103] ;

[0104] ;

[0105] ;

[0106] in, is the answer word vector, is the answer sentence vector, is the answer feature vector, is the answer word vector weight, is the answer sentence vector weight, is the character-independent problem feature vector, Score the relevance of questions and answers, For modulus length operation, is the question-answer relevance feature;

[0107] S32: Generate explanation text based on question-answer correlation features. The calculation method is:

[0108] ;

[0109] in, To explain the text.

[0110] In the real-time question-answering system, since the answers to questions are generated by artificial intelligence rather than by professional subject teachers, there may be errors in the answers. In view of this feature, the present invention adopts a method of generating explanation texts to assist users in understanding the origin of the answers. Traditional methods ignore this step, and users need to read the answers carefully to find out whether the answers are correct or not. The present invention first extracts the word vectors and sentence vectors of the answers through the RoBERTa model, and weightedly fuses them to obtain the answer feature vector. Then, the correlation score between the question and the answer is calculated by combining the character-independent question feature vectors, and then generates the explanation text.

[0111] When calculating the relevance score between questions and answers, since only the relevance features of questions and answers need to be calculated and the precise understanding of the meaning of specific characters is not involved, the model needs to focus more on overall logical judgment; and character-level information is often more specific and detailed, while word vectors and sentence vectors can capture more abstract and general semantic features. Therefore, the character-level word embedding vectors are eliminated in this step to improve the generalization ability of the model.

[0112] S4: In the authenticity verification module of the real-time question answering model, the confidence of the answer is calculated based on the preprocessed question data, the answer to the question and the explanation text;

[0113] S41: In the authenticity verification module of the real-time question answering model, the answer confidence feature vector is calculated based on the preprocessed question data, the question answer and the explanation text. The calculation method is:

[0114] ;

[0115] in, is the answer confidence feature vector;

[0116] S42: Calculate the answer confidence according to the answer confidence feature vector, and the calculation method is:

[0117] ;

[0118] in, Confidence of the answer.

[0119] In order to ensure the authenticity of the answer, in addition to generating an explanatory text, it is also necessary to quantify the authenticity in the form of a score to help users save reading time; therefore, the present invention utilizes an authenticity verification module, combines the preprocessed question data, the question answer and the explanatory text to extract the answer confidence feature vector, and calculates the answer confidence.

[0120] In addition, when the length of the text to generate the answer exceeds 10 segments (each comma is 1 segment), step S4 of the present invention can be replaced by the following form, outputting low-confidence segmented answers to allow the user to locate the location of the low-confidence answer, such as Figure 4 As shown;

[0121] S41: Divide the answer to the question by commas to get segmented answers , n is the segment number index;

[0122] S42: Construct an authenticity verification module for the real-time question answering model, and calculate the confidence of the segmented answer based on the preprocessed question data, the segmented answer and the explanation text. The calculation method is:

[0123] ;

[0124] ;

[0125] in, is the confidence feature vector of the nth segment answer, The confidence level of the answer to the nth segment;

[0126] S43: The importance of the segmented answers is judged, and the confidence of the segmented answers is integrated and calculated to obtain the answer confidence. The calculation method is:

[0127] ;

[0128] ;

[0129] in, is the weight of the segment answer, is the attention mechanism operation, is the confidence of the answer, i is the confidence calculation index;

[0130] S44: According to the answer confidence and the segment answer confidence, adaptive calculation is performed to output a low-confidence segment answer. The calculation method is:

[0131] ;

[0132] ;

[0133] in, is the adaptive factor, is the average confidence of the segmented answers, is the standard deviation of the confidence of the segmented answers, is a constant, is the corrected confidence of the segmented answer;

[0134] Sort all corrected segmented answer confidences in ascending order;

[0135] ;

[0136] ;

[0137] in, is the difference of confidence of all adjacent corrected segment answers, j is the difference index, is the confidence of all corrected segment answers for the j+1th segment, is the confidence of all corrected segmented answers for the jth time, T is the difference threshold, is the threshold adjustment parameter;

[0138] like , then the output As a low confidence segment answer, is the jth segment answer;

[0139] For example:

[0140] Question: Please explain what deep learning is and list five major applications of it in the field of natural language processing.

[0141] Answer: Deep learning is a machine learning method that simulates the learning process of the human brain through multi-layer neural networks to achieve complex feature extraction and pattern recognition. In the field of natural language processing, deep learning applications, such as:

[0142] 1. Text classification, such as sentiment analysis, topic classification, etc.;

[0143] 2. Semantic understanding, such as question-answering systems, semantic search, etc.

[0144] 3. Machine translation, realizing automatic conversion between different languages;

[0145] 4. Text generation, such as intelligent writing, summary generation, etc.;

[0146] 5. Speech recognition, converting speech signals into text information.

[0147] In this case, point 5 “Speech recognition” is actually more in the field of speech processing rather than pure natural language processing, so this text should have a lower confidence level in this answer.

[0148] The relevant parameters for confidence calculation are:

[0149] Number of segmented answers n=5

[0150] Segment answer confidence feature vector = [0.95, 0.90, 0.88, 0.92, 0.70]

[0151] Segment answer weight = [0.2, 0.2, 0.2, 0.2, 0.2] (in this example, each segment answer has the same importance)

[0152] Adaptive factor α=1

[0153] The average confidence of the segmented answers is μ=0.87

[0154] The standard deviation of the confidence of the segmented answers is σ = 0.09

[0155] constant

[0156] Threshold adjustment parameters (Do not adjust the threshold)

[0157] but:

[0158] Answer confidence = 0.2 * (0.95 + 0.90 + 0.88 + 0.92 + 0.70) = 0.87

[0159] Corrected segment answer confidence = [0.95, 0.90, 0.88, 0.92, 0.70]

[0160] The confidence of the corrected segmented answers after sorting = [0.95, 0.92, 0.90, 0.88, 0.70]

[0161] Difference threshold T = (0.03 + 0.02 + 0.02 + 0.18) / 4 = 0.25 / 4 = 0.115

[0162] Since the confidence difference between 0.70 and 0.082 is greater than 0.115, the fifth segment "speech recognition" is a low-confidence segment answer;

[0163] This adaptive calculation method has significant advantages over the traditional method of simply sorting and then outputting the lowest value. When all answer segments are high-confidence, the traditional method cannot make intelligent judgments and will still incorrectly mark the answer segment with the relatively lowest confidence (although it is also very high, such as 0.97), which may cause confusion and misunderstanding to users in practical applications. However, this dynamic adaptive method, by introducing adaptive calculation and confidence threshold judgment, can intelligently identify that when all answer segments maintain high confidence, no low-confidence answer segments are output, thereby effectively avoiding the situation where high-confidence answers (such as 0.97) are incorrectly marked as low-confidence, thereby improving the accuracy of answering questions and user experience.

[0164] S5: Use incremental learning to train the real-time question answering model;

[0165] S51: iCaRL is selected as the incremental learning framework, and the learning rate is set to 0.001, the number of iterations is set to 20, and the weight of the real-time question answering model is loaded;

[0166] S52: Freeze all layers before the last three layers of the real-time question answering model, start real-time question answering model training, and use ReduceLROnPlateau to adaptively adjust the learning rate;

[0167] S53: If the accuracy of the real-time question answering model is improved after the training is completed compared to before the training, the updated real-time question answering model weight and configuration information are saved;

[0168] S54: If the accuracy of the real-time question answering model decreases after training compared to before training, the model weights and configuration information are not updated, and the learning rate is halved and training is performed again.

[0169] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in multiple embodiments of the present invention.

[0171] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A real-time question answering method based on a large language model, characterized in that: The following steps are involved: S1: Collect question data and perform format conversion, word segmentation, and stop word removal, and copy the formula in the question data to the end of the question data to obtain the preprocessed question data; S2: construct a real-time question answering model, which includes an answer generation module, an explanation text generation module, and an authenticity verification module; And in the answer generation module of the real-time question answering model, the answer to the question is generated based on the preprocessed question data; In step S2, in the answer generation module of the real-time question answering model, based on the preprocessed question data, the question answer is generated, including: S21: The answer generation module includes a question feature extraction part and an answer generation part; the question feature vector is calculated by the question feature extraction part, and the calculation method is: ; ; ; ; ; in, is a character vector, for Network operations, is the preprocessed problem data, is the word vector, is the sentence vector, for Pre-trained language model operations, is the semantic feature vector, is the character weight, is the word weight, is the sentence weight, is the formula vector, The formula that is copied to the end of the problem data separately in the preprocessed problem data. is the problem feature vector, Operate for multi-layer perceptron; S22: Generate the answer to the question through the answer generation part, and the calculation method is: ; ; ; like ,but: ; like ,but: ; in, Extract sequence features for the answer, for Network operations, Generate sequence features for the answer, Extract scores for answers, is a gated recurrent unit operation, For the answer to the question, for Model operation; S23: inputting the preprocessed question data into the answer generation module to generate the answer to the question; S3: In the explanation text generation module of the real-time question answering model, an explanation text is generated based on the preprocessed question data and the question answer; The S3 step includes: S31: In the explanation text generation module of the real-time question answering model, the question-answering correlation feature is calculated based on the preprocessed question data and the question answer. The calculation method is: ; ; ; ; ; in, is the answer word vector, is the answer sentence vector, is the answer feature vector, is the answer word vector weight, is the answer sentence vector weight, is the character-independent problem feature vector, Score the relevance of questions and answers, For modulus length operation, is the question-answer relevance feature; S32: Generate explanation text based on the question-answer correlation feature. The calculation method is: ; in, To explain the text; S4: In the authenticity verification module of the real-time question answering model, the confidence of the answer is calculated based on the preprocessed question data, the answer to the question and the explanation text; The S4 step includes: S41: In the authenticity verification module of the real-time question answering model, the answer confidence feature vector is calculated based on the preprocessed question data, the question answer and the explanation text. The calculation method is: ; in, is the answer confidence feature vector; S42: Calculate the answer confidence according to the answer confidence feature vector, and the calculation method is: ; in, Confidence level for the answer; S5: Use incremental learning to train the real-time question-answering model.

2. The real-time question answering method based on a large language model according to claim 1, characterized in that: The S1 step includes: S11: Collect question data, where the question data is a question sentence or a declarative sentence text expressed in a natural language, including multiple words, phrases, sentences and formulas; and convert the question data into a JSON format to obtain question data in a JSON format; S12: Use the jieba word segmentation tool to perform word segmentation on the question data in json format to obtain the question data after word segmentation; S13: Use the jieba word segmentation tool to traverse the question data after word segmentation, delete the stop words in the jieba stop word list, and obtain the question data after deleting the stop words; then copy the formula in the question data after deleting the stop words to the end of the question data separately to obtain the preprocessed question data.

3. The real-time question answering method based on a large language model according to claim 1, characterized in that: In the step S2, the answer generation module calculates the question feature vector based on the preprocessed question data through the question feature extraction part, and then generates the question answer; the explanation text generation module calculates the question-answer correlation feature and generates the explanation text according to the preprocessed question data and the question answer; the authenticity verification module calculates the answer confidence feature vector according to the preprocessed question data, the question answer and the explanation text, and then calculates the answer confidence according to the answer confidence feature vector.

4. The real-time question answering method based on a large language model according to claim 1, characterized in that: The S5 step includes: S51: iCaRL is selected as the incremental learning framework, and the learning rate is set to 0.001, the number of iterations is set to 20, and the weight of the real-time question answering model is loaded; S52: Freeze all layers before the last three layers of the real-time question answering model, start real-time question answering model training, and use ReduceLROnPlateau to adaptively adjust the learning rate; S53: If the accuracy of the real-time question answering model is improved after the training is completed compared to before the training, the updated real-time question answering model weight and configuration information are saved; S54: If the accuracy of the real-time question answering model decreases after training compared to before training, the model weights and configuration information are not updated, and the learning rate is halved and training is performed again.