A new question correction method and system based on large model
By obtaining context information of new propositions and using pre-trained language models for semantic analysis, combined with domain knowledge base verification, the problem of error correction of new propositions is solved, the accuracy and efficiency of error correction are improved, and the new types are achieved Intelligent handling of errors.
Patent Information
- Application Number
- CN202411272928.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-09-12
Smart Images

Figure CN118798201B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a new proposition error correction method and system based on a large model. Background Art
[0002] In the existing technology, automatic error correction technologies based on natural language processing (NLP) and machine learning algorithms have been widely used. These technologies usually identify and correct grammatical, spelling and logical errors in texts by training models, especially in grammar correction and spelling checking. Existing error correction systems often rely on pre-defined rules or dictionaries, combined with statistical models or deep learning models to detect and correct errors. These technologies show high accuracy and efficiency when processing standardized texts. With the development of natural language processing technology, especially the application of large language models (LLMs), more complex and innovative text generation tasks have emerged. Large language models can generate texts containing new propositions or non-standard expressions, which brings new challenges to existing error correction methods.
[0003] Existing error correction techniques usually rely on predefined rules or standard language structures, but when faced with innovative expressions generated by large models, these techniques are often difficult to adapt and cannot effectively identify and correct errors. Especially when dealing with new propositions, because these expressions may not conform to existing language specifications or contain innovative logical deductions, existing error correction techniques often have a high misjudgment rate. In addition, the uniqueness and diversity of new propositions make it difficult for existing technologies to cover all possible error types, which further increases the difficulty of error correction. Therefore, how to develop more intelligent and flexible error correction methods to improve accuracy and efficiency when dealing with new propositions has become a key issue in current research. At present, although some studies have tried to improve the error correction effect by enhancing the adaptability of the model or combining multiple technical means, there are still problems such as insufficient recognition accuracy and limited ability to handle new types of errors. Summary of the invention
[0004] The purpose of the present invention is to provide a new proposition error correction method and system based on a large model, so as to solve the problem of how to develop a more intelligent and flexible error correction method to improve the accuracy and efficiency when processing new propositions. Although there have been some studies in the prior art that have attempted to improve the error correction effect by enhancing the adaptability of the model or combining a variety of technical means, there are still problems such as insufficient recognition accuracy and limited ability to handle new types of errors.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for correcting errors in new propositions based on a large model, the method comprising:
[0006] S1: Obtain the generated new proposition and its corresponding context information;
[0007] S2: Perform semantic analysis on new propositions based on the pre-trained language model to identify potential errors;
[0008] S3: Use domain-specific knowledge base to verify the accuracy of the new proposition;
[0009] S4: Automatically correct errors in new propositions based on analysis results and verification feedback;
[0010] The step S1 of obtaining the generated new proposition and its corresponding context information specifically includes:
[0011] Receive the output new proposition text through the API interface;
[0012] Extract key words from new proposition text;
[0013] Build context based on key words;
[0014] Use natural language processing techniques to identify entities and relations in new propositions;
[0015] The calculation of the similarity S between the new proposition and the standard expression in the field based on the semantic vector representation specifically includes:
[0016] Normalize the semantic vector representation of the new proposition;
[0017] Calculate the cosine similarity C between the normalized semantic vector representation and the standard expression vector representation in the field;
[0018] If the cosine similarity C is less than 0.7, it is considered that the new proposition does not match the standard statement, that is, when C<0.7, it is determined that there is a large difference between the new proposition and the standard statement;
[0019] Adjust the calculation method of similarity S based on the mismatch situation;
[0020] The specific steps of calculating the cosine similarity C between the normalized semantic vector representation and the standard expression vector representation in the field include:
[0021] Determine the semantic vector representation V1 of the new proposition and the vector representation V2 of the standard statement;
[0022] Calculate the dot product P of V1 and V2;
[0023] Calculate the modulus lengths M1 and M2 of V1 and V2;
[0024] Calculate the cosine similarity according to the formula cosine similarity C=P / (M1×M2);
[0025] The step S3 specifically includes:
[0026] Extract relevant data from a predefined domain-specific knowledge base that contains facts, rules, logical relationships, and domain-specific concepts;
[0027] Let the knowledge base be K, the new proposition be P,
[0028] For each sub-proposition Pi in P, find the set of propositions {k1, k2, ..., kn} in K that is closest to Pi in semantics.
[0029] Calculate the similarity between proposition Pi and the corresponding proposition Kj in K , using the cosine similarity formula: ,
[0030] in, and is the semantic vector representation of the corresponding proposition;
[0031] According to the rules and logic in the knowledge base, the logical consistency of the new proposition and the known knowledge is verified, the overall accuracy of the new proposition PPP is evaluated, and the similarity and logical consistency of each sub-proposition are comprehensively considered to obtain the confidence score C(P) of the new proposition:
[0032] ,
[0033] in, is the logical consistency score.
[0034] Preferably, the step of performing semantic analysis on the new proposition based on the pre-trained language model in step S2 specifically includes:
[0035] Input the new proposition into the pre-trained language model to obtain a semantic vector representation;
[0036] Calculate the similarity S between the new proposition and the standard expression in the field based on the semantic vector representation;
[0037] If the similarity S is lower than the preset threshold T, it is determined that the new proposition may have semantic errors;
[0038] Compare the key differences between the new proposition and the standard statements in the field.
[0039] Preferably, the specific steps of performing semantic analysis on the new proposition based on the pre-trained language model in step S2 to identify potential errors therein include:
[0040] Obtaining lexical structure information of new propositions;
[0041] Calculate the grammatical probability score P(grammar) of the new proposition based on the language model;
[0042] Determine whether the grammar probability score P(grammar) is lower than a first preset threshold θ1;
[0043] If P(grammar) < θ1, then the recognition of the new proposition may contain grammatical errors;
[0044] The specific steps of calculating the grammatical probability score P(grammar) of the new proposition based on the language model include:
[0045] Perform word segmentation on the new proposition to obtain a vocabulary sequence;
[0046] Calculate a probability score P(vocabulary) of the vocabulary sequence based on a language model;
[0047] Calculate the context relevance score P(context) of the new proposition;
[0048] The grammatical probability score P(grammar) is calculated according to the formula P(grammar) = P(vocabulary) × P(context).
[0049] Preferably, the specific steps of calculating the context relevance score P(context) of the new proposition include:
[0050] Obtaining context information of the new proposition;
[0051] Calculate the relevance scores P(previous) and P(next) of the context information based on the language model;
[0052] Determine whether the correlation scores P(front) and P(back) are both higher than a second preset threshold θ2;
[0053] If P(pre) > θ2 and P(post) > θ2, then P(context) = (P(pre) + P(post)) / 2;
[0054] The specific steps of calculating the relevance scores P(previous) and P(after) of the context information based on the language model include:
[0055] Extract the keywords of the context of the new proposition;
[0056] Calculate the probability P(keyword) of the keyword appearing in the context based on the language model;
[0057] Calculate the semantic similarity S (semantic) between the keyword and the new proposition;
[0058] The relevance scores P(front) and P(back) are calculated according to the formula P(front) / P(back) = P(keyword) × S(semantic).
[0059] Preferably, the specific steps of calculating the semantic similarity S (semantics) between the keyword and the new proposition include:
[0060] The keywords and new propositions are vectorized into vectors V keywords and V new propositions respectively;
[0061] Calculate the cosine similarity COS between the vector V keyword and V new proposition;
[0062] If COS>the third preset threshold θ3, then S(semantic)=COS.
[0063] Preferably, the step S4 specifically includes:
[0064] Based on the similarity and logical consistency results in step S3, determine the location of the error in the proposition and locate the error point of each sub-proposition Pi. If Less than the preset threshold , then the sub-proposition is considered to be wrong;
[0065] Use the correct proposition set {k1, k2, ..., kn} in the domain-specific knowledge base to correct errors, use the replacement strategy, select the proposition Kj with the highest similarity to Pi and the best logical consistency to replace the erroneous part of Pi, and the corrected proposition for:
[0066] ;
[0067] The revised new proposition Verify the knowledge base again to ensure the consistency of its semantics and logic. If the revised proposition still does not meet the conditions, further adjustments are made until the confidence level of the proposition reaches Reach the set threshold.
[0068] A new proposition error correction system based on a large model, using the new proposition error correction method based on a large model, the system comprises:
[0069] A context information acquisition module, which is used to acquire new propositions generated by the large model and their corresponding context information;
[0070] A semantic analysis module, which performs semantic analysis on new propositions based on a pre-trained language model to identify potential errors in new propositions;
[0071] A verification module that verifies the accuracy of new propositions using a domain-specific knowledge base;
[0072] The correction module automatically corrects errors in new propositions based on semantic analysis results and verification feedback.
[0073] It can be seen from the above technical solution that the present invention has the following beneficial effects:
[0074] The method and system for correcting new propositions based on a large model obtain the generated new propositions and their corresponding contextual information, perform semantic analysis on the new propositions based on a pre-trained language large model, identify potential errors therein, verify the accuracy of the new propositions using a domain-specific knowledge base, and automatically correct errors in the new propositions based on the analysis results and verification feedback, so that the correction of new propositions is more intelligent and flexible, especially when dealing with new types of errors that do not have clear rules to follow, and improves accuracy and efficiency. It solves the problem of how to develop a more intelligent and flexible correction method to improve the accuracy and efficiency when dealing with new propositions. Although some studies in the prior art have attempted to improve the correction effect by enhancing the adaptability of the model or combining a variety of technical means, there are still problems such as insufficient recognition accuracy and limited ability to handle new types of errors. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0076] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0077] like Figure 1 As shown, a method for correcting errors in new propositions based on a large model, the method comprising:
[0078] S1: By obtaining the generated new proposition and its corresponding contextual information, we first ensure that we can fully understand the meaning of the proposition in a specific context. This process usually involves extracting specific sentences or phrases from the output and collecting related background information, conversation history and other auxiliary information. For example, suppose a new proposition about climate change is generated: "Global temperatures have dropped by 5 degrees in the past decade." In order to better understand this proposition, we need to collect details about the time range, data source, measurement standards, etc. This step is crucial for subsequent semantic analysis because it provides the necessary context to evaluate the truthfulness and accuracy of the proposition. In addition, in practical applications, we may also need to consider how to efficiently filter out relevant information fragments from a large amount of text data to support subsequent analysis.
[0079] S2: Perform semantic analysis on the new proposition based on a pre-trained language model to identify potential errors. At this stage, we use advanced natural language processing techniques, such as pre-trained models such as BERT and GPT-3, to deeply analyze the semantic structure of the new proposition. These models are trained on a large amount of text data and are able to capture complex language patterns and contextual relationships. For example, for the new proposition about global temperature change mentioned earlier, the pre-trained model may find that the statement "a drop of 5 degrees in the past decade" is inconsistent with the known trend of climate change, because according to the existing scientific consensus, global temperatures are actually rising rather than falling. This analysis is not limited to factual errors, but can also cover problems such as logical inconsistencies and semantic ambiguity. In this way, we can more accurately identify potential problems in new propositions.
[0080] S3: By verifying the accuracy of the new proposition using a domain-specific knowledge base, we further ensure the reliability and authenticity of the new proposition. A domain-specific knowledge base contains expertise and data in a specific field, such as a meteorological database, scientific research results, etc. Continuing with the above example of climate change, we can query the data records on global temperature changes in the meteorological database to verify whether the statement "it has dropped by 5 degrees in the past decade" is correct. If the database shows that global temperatures are actually rising, then it can be determined that the original proposition is wrong. In addition, expert systems or professional literature can be used to further confirm the accuracy of the new proposition. The advantage of this approach is that it can compare the content generated by the large model with the authoritative data source, thereby improving the accuracy of identifying errors.
[0081] S4: By automatically correcting the errors in the new proposition according to the analysis results and verification feedback, we finally achieved effective error correction of the new proposition. Based on the analysis and verification in the previous steps, the system automatically proposes correction suggestions. For example, for the aforementioned new proposition about global temperature change, the system may suggest that it be modified to: "Global temperature has risen by X degrees in the past decade." The X degrees here are calculated based on data in the domain-specific knowledge base. In addition, the correction process may also include adjustments to semantically ambiguous or logically inconsistent parts to ensure that the new proposition is both accurate and clear. In this way, we can not only correct errors, but also improve the quality of new propositions to make them more in line with actual conditions.
[0082] Through the above steps, the problem of "how to effectively identify and correct errors in new propositions generated by large models" can be solved. The whole process starts with obtaining new propositions and their contextual information, identifying potential errors through semantic analysis, using domain knowledge to verify accuracy, and finally automatically correcting errors, forming a complete error correction mechanism. This method not only improves the accuracy of new propositions, but also enhances the reliability of generated content, which is of great significance for improving the overall performance of artificial intelligence systems.
[0083] Next, the specific steps for obtaining the generated new proposition and its corresponding context information are described:
[0084] Receive the output new proposition text through the API interface. This process involves interaction with the large model, which is usually implemented by calling a pre-defined application programming interface API. Specifically, when a new proposition text is generated, the text will be transmitted to the error correction system through the API interface for further processing and analysis.
[0085] Extract key words from the new proposition text. After receiving the new proposition text, the system needs to perform a preliminary analysis of the text content to identify the key information. This step can be completed through a variety of natural language processing technologies, such as part-of-speech tagging, named entity recognition, etc., to screen out words that are crucial to understanding the meaning of the text.
[0086] Build context based on key words. In order to more accurately understand the meaning of the new proposition and the context it is in, the system will use the extracted key words to build a context. This may involve analyzing the correlation between key words and combining the knowledge base of related fields to enhance the understanding of the text background.
[0087] Use natural language processing technology to identify entities and relationships in new propositions. Finally, the system needs to deeply analyze the entity information in the new proposition and their relationships. This step can be completed with the help of advanced natural language processing technologies such as dependency parsing and semantic role labeling, in order to more comprehensively understand the content of the new proposition and its potential meaning.
[0088] Next, the specific steps involved in the process of semantically analyzing the new proposition based on the pre-trained language model are described:
[0089] The semantic vector representation is obtained by inputting the new proposition into a pre-trained language model. This process involves passing the new proposition to be analyzed as input to a pre-trained language model. The language model is usually a deep learning model trained on a large amount of text data, which can capture the complex structure and semantic information in the language. When a new proposition is input, the model processes it and generates one or more artificial vectors, which can be regarded as the semantic representation of the new proposition.
[0090] The similarity S between the new proposition and the standard expression in the field is calculated based on the semantic vector representation. After obtaining the semantic vector representation of the new proposition, the next step is to calculate the similarity between this representation and the known standard expression in the field. This step can be achieved in many ways, such as using cosine similarity, Euclidean distance or other measurement methods to quantify the similarity between two vectors. The value of similarity S reflects the semantic closeness between the new proposition and the standard expression.
[0091] If the similarity S is lower than the preset threshold T, the new proposition is judged to have possible semantic errors. After calculating the similarity S, it is compared with a pre-set threshold T. If S is less than T, it is considered that the new proposition has a large semantic difference from the standard expression in the field and may contain semantic errors or inaccurate expressions. The choice of this threshold depends on the specific application scenario and the requirements for error tolerance.
[0092] Compare the key differences between the new proposition and the standard statement in the field. Once it is determined that the new proposition may have semantic errors, the next step is to further analyze the key differences between the new proposition and the standard statement. This can be done by comparing the semantic vector representations of the two to find out the specific reasons for the low similarity. For example, you can identify where specific words or phrases in the new proposition are inconsistent with the standard statement, and make suggestions for changes to improve the accuracy of the new proposition.
[0093] Next, we describe the specific steps of calculating the similarity S between the new proposition and the standard expression in the field based on the semantic vector representation:
[0094] First, semantic analysis is performed on the new proposition to obtain its semantic vector representation, and then normalization is performed on it. This process ensures that vectors of different lengths can be compared under a unified standard, thereby avoiding the influence of vector length differences on similarity calculations. Normalization is usually performed using the L2 norm or other normalization methods.
[0095] Next, the cosine similarity C between the normalized semantic vector representation of the new proposition and the vector representation of the standard expression in the field is calculated. Cosine similarity is a method to measure the cosine value of the angle between two non-zero vectors, which is used to evaluate the directional similarity between them. The cosine similarity C is obtained by calculating the dot product of the two vectors divided by the product of their respective moduli.
[0096] Then, determine whether the cosine similarity C is less than the threshold value of 0.7. If the cosine similarity C is less than 0.7, it is considered that the new proposition is semantically different from the standard statement, that is, it does not match. It should be noted that in actual applications, the value range of cosine similarity is [-1, 1], so the threshold value of 0.7 here may be a typo or an error in expression. The normal threshold should be a suitable value within this range.
[0097] Finally, the calculation method of similarity S is adjusted based on the above mismatch. For example, other factors such as vocabulary overlap, syntactic structure similarity, etc. can be introduced to comprehensively evaluate the similarity S between the new proposition and the standard statement, or the threshold of cosine similarity can be adjusted to adapt to different application scenarios and needs.
[0098] Next, the specific steps of calculating the cosine similarity C between the normalized semantic vector representation and the standard expression vector representation in the field are described:
[0099] Determine the semantic vector representation V1 of the new proposition and the vector representation V2 of the standard statement
[0100] In this step, we first need to obtain the semantic vector representation V1 of the new proposition after preprocessing and normalization, as well as the vector representation V2 of the standard expression in the field. These vector representations are usually generated by a pre-trained language model and can capture the semantic information in the text. For example, BERT, ROBERTA or other similar deep learning models can be used to extract the semantic features of the text and convert them into a fixed-length vector form.
[0101] Calculate the dot product P of V1 and V2;
[0102] Next, calculate the dot product P between the two vectors V1 and V2 obtained above. The dot product is a mathematical operation that measures the sum of two vectors after multiplying their elements on the same dimension. Specifically, if V1 and V2 are both n-dimensional vectors, the dot product P can be obtained by multiplying the i-th element of V1 with the i-th element of V2 and then summing them, that is:
[0103] ;
[0104] Among them, V 1 (i) represents the vector V 1 The i-th element of V2 (i) represents the vector V 2 The i-th element of , n is the dimension of the vector, × represents the product of the elements, and ∑ represents the sum from the 1st to the nth element.
[0105] Calculate the modulus lengths M1 and M2 of V1 and V2;
[0106] After calculating the dot product, we need to further calculate the modulus M1 and M2 of the two vectors V1 and V2. The modulus or norm of a vector is an indicator of the length of the vector, which can be obtained by summing the squares of the components of the vector and then taking the square root. For vector V1, the formula for calculating its modulus M1 is:
[0107] ;
[0108] For vector V2, the calculation formula for its modulus M2 is:
[0109] ;
[0110] Calculate the cosine similarity C;
[0111] The last step is to calculate the cosine similarity C, which is obtained by dividing the dot product P by the product of the modulus lengths of the two vectors M1×M2. The formula for calculating cosine similarity C is C=P / (M1×M2). The value range of cosine similarity is between -1 and 1, where 1 means that the two vectors are exactly the same, 0 means that the two vectors are orthogonal, that is, there is no correlation, and -1 means that the two vectors are in opposite directions. In this way, we can quantify the degree of semantic similarity between the new proposition and the standard statement in the field.
[0112] Next, we describe the specific steps of judging the matching degree between the new proposition and the standard statement by cosine similarity:
[0113] By calculating the cosine similarity between the new proposition and the standard statement: First, convert the new proposition and the standard statement into vector representation, which can be done through a pre-trained semantic model. Then, use these vectors to calculate the cosine similarity C between the two. Cosine similarity is a measure of the angle between two non-zero vectors, and its value range is between -1 and 1. The closer the value is to 1, the more similar the two vectors are.
[0114] The matching degree between the new proposition and the standard statement is judged by setting a threshold: when the calculated cosine similarity C is less than 0.7, that is, C<0.7, it is considered that there is a large difference between the new proposition and the standard statement, that is, it does not match. This means that there is a significant difference in semantics between the new proposition and the standard statement, which may be because the new proposition contains some wrong or inaccurate information.
[0115] Take appropriate measures based on the judgment results: Once it is determined that there are significant differences between the new proposition and the standard statement, the system can further analyze the specific problems in the new proposition and provide correction suggestions or directly give the correct standard statement as a reference to help users understand and correct errors in the new proposition.
[0116] Next, we describe the specific steps of the recognition process in which semantic analysis is performed using a pre-trained language model to identify potential errors:
[0117] Obtaining the lexical structure information of the new proposition. In this stage, the new proposition is first received as input and processed to extract the basic lexical units that constitute the proposition and their position and role in the sentence. This step usually involves using natural language processing technology to parse the sentence structure, such as using dependency parsing or component parsing to determine the relationship between individual words and their functional roles in the sentence.
[0118] The grammatical probability score P(grammar) of the new proposition is calculated based on the language model. Next, the pre-trained language model is used to evaluate the grammatical correctness of the entire new proposition. This process involves passing the new proposition to the language model, which calculates the possibility of the proposition being a legal sentence based on the probability distribution learned internally. The resulting grammatical probability score P(grammar) reflects the rationality of the proposition at the grammatical level.
[0119] Determine whether the grammatical probability score P(grammar) is lower than the first preset threshold θ1 - The system then checks whether the calculated P(grammar) value is lower than a pre-set threshold θ1. If P(grammar) is less than θ1, it indicates that the new proposition may have errors at the grammatical level. The choice of threshold needs to be determined based on the specific application scenario and the capabilities of the language model to ensure that errors can be effectively detected while avoiding false positives.
[0120] If P(grammar) < θ1, the new proposition is identified as a sentence that may contain grammatical errors. When P(grammar) is indeed lower than θ1, the system will mark the new proposition as a sentence that may contain grammatical errors. At this point, further measures can be taken to correct these errors, such as providing modification suggestions or directly applying automatic correction algorithms to improve the grammatical structure of the sentence.
[0121] Through the above steps, the present invention can effectively utilize the powerful ability of the pre-trained language model to identify and correct grammatical errors in new propositions, thereby improving the overall quality of the text.
[0122] Next, we describe the specific steps for calculating the grammatical probability score P(grammar) of a new proposition based on the language model:
[0123] The new proposition is segmented to obtain a series of words constituting the proposition, namely, a word sequence. This process utilizes the word segmentation technology in natural language processing to ensure that each word unit in the new proposition can be accurately identified, providing a basis for subsequent probability calculations.
[0124] The probability score P(vocabulary) of the above word sequence is calculated by applying a pre-trained language model. In this step, the language model evaluates the probability score of the entire sequence based on the probability of each word appearing in the word sequence and the combination relationship between them, reflecting the linguistic rationality of the word sequence.
[0125] The context relevance score P(context) is calculated by analyzing the degree of association between the new proposition and the context. Specifically, techniques such as attention mechanisms can be used to measure the semantic coherence and consistency between the new proposition and the context, thereby quantifying whether it is reasonable in a specific context.
[0126] Finally, the grammatical probability score P(grammar) of the new proposition is calculated comprehensively by the formula P(grammar) = P(vocabulary) × P(context). This means that the grammatical correctness of the new proposition depends not only on the rationality of its internal vocabulary sequence P(vocabulary), but also on the degree to which it matches the context P(context). This comprehensive evaluation method helps to judge the grammatical quality of the new proposition more comprehensively.
[0127] Next, we describe the specific steps for calculating the contextual relevance score P(context) of a new proposition:
[0128] The process begins by obtaining the contextual information of the new proposition to be processed. This step involves identifying the text fragments directly adjacent to the new proposition, which constitute the context of the new proposition. For example, in a continuous text, if the new proposition is sentence "B", then sentence "A" as the preceding context and sentence "C" as the following context will be extracted for subsequent analysis.
[0129] The relevance scores P(previous) and P(next) of the context information are calculated by using a pre-trained language model. Specifically, the language model evaluates the semantic coherence between sentence "A" and sentence "B" and the semantic coherence between sentence "C" and sentence "B", and gives a numerical value to indicate the degree of such coherence. For example, advanced language models such as BERT or GPT can be used for such calculations.
[0130] Next, determine whether the obtained relevance scores P(pre) and P(post) are both higher than the second preset threshold θ2. This threshold is the minimum standard for measuring the relevance between the context and the new proposition. If both scores exceed this threshold, the new proposition is considered to have good consistency with its context; otherwise, it is considered to have poor consistency. For example, assuming that θ2 is set to 0.6, if P(pre) = 0.75 and P(post) = 0.80, the condition is met.
[0131] If P(pre)>θ2 and P(post)>θ2, then calculate the contextual relevance score P(context) of the new proposition, that is, P(context) = P(pre) + P(post)\2. This means that the relevance scores of the new proposition with the context before and after will be averaged to obtain a comprehensive score that reflects the consistency level of the new proposition in the overall context. For example, if P(pre) = 0.75 and P(post) = 0.80, then P(context) = 0.75 + 0.80 / 2 = 0.775.
[0132] Next, the specific steps for calculating the relevance scores P(previous) and P(after) of the context information are described:
[0133] First, extract the contextual keywords of the new proposition. This process involves analyzing the new proposition and its context to identify words or phrases that are closely related to the new proposition. These keywords can be nouns, verbs, or other key elements that reflect the meaning of the context. For example, if the new proposition is "The largest planet in the solar system is Jupiter", then the keywords may include "solar system", "largest", and "Jupiter".
[0134] Next, the probability P(keyword) of the keyword appearing in the context is calculated based on the language model. This step uses a pre-trained language model to evaluate the likelihood of a keyword appearing in a given context. For example, in the above example, the language model may give a high probability for "solar system", while the probabilities of "largest" and "Jupiter" are determined based on how often they appear in the context.
[0135] Then, the semantic similarity S (semantic) between the keyword and the new proposition is calculated. This step usually involves using a semantic similarity algorithm to measure the strength of the relationship between the keyword and the new proposition. For example, methods such as cosine similarity can be used to quantify the degree of semantic association between the keyword and the new proposition.
[0136] Finally, the relevance scores P(front) and P(back) are calculated according to the formula P(front) / P(back) = P(keyword) × S(semantic). This means that the probability of the keyword appearing in the context is multiplied by its semantic similarity to the new proposition to obtain a comprehensive score that represents the relevance of the keyword to the new proposition in the context. For example, if "solar system" has a high probability of appearing in the context and has a strong semantic association with the new proposition, it will receive a high relevance score.
[0137] Next, the specific steps of calculating the semantic similarity S(semantic) between the keyword and the new proposition are described:
[0138] The keywords and new propositions are represented by vectors Vkeywords and Vnewpropositions respectively. This process usually involves using a pre-trained language model or word embedding technology to convert the keywords and new propositions in the text into numerical vector form. For example, these vectors can be obtained using models such as Word2Vec, GloVe, or more advanced BERT. These models can capture the meaning of words in different contexts and map them into a multidimensional space so that words with similar semantics are close to each other in this space.
[0139] Calculate the cosine similarity COS between vectors V keyword and V new proposition. Cosine similarity is a measure of the angle between two non-zero vectors, used to evaluate the consistency of their directions. Specifically, it can be calculated by the formula COS = V keyword · V new proposition \||V keyword||×||V new proposition||, where · represents the vector dot multiplication operation, ||V keyword|| and ||V new proposition|| represent the modulus or length of the two vectors respectively. The COS value obtained in this way ranges from -1 to 1. The closer the value is to 1, the more similar the two vectors are.
[0140] If COS> the third preset threshold θ3, then S (semantics) = COS. A threshold θ3 is introduced here as a judgment criterion. Only when the calculated cosine similarity COS is greater than this threshold, it is considered that there is a high semantic similarity between the keyword and the new proposition, and COS is assigned to S (semantics). For example, assuming that θ3 is set to 0.7, then only when COS is greater than 0.7, it is considered that the keyword and the new proposition have a strong semantic correlation. This setting helps to filter out keyword combinations with large semantic differences, thereby improving the effectiveness and accuracy of the new proposition error correction method.
[0141] In actual operation, when the device is used, it first receives new propositions generated by the large model and their related contextual information through the input interface. This information is then passed to the language model module, which performs in-depth semantic analysis on the new proposition based on the pre-trained language model to identify potential grammatical or logical errors that may exist in it. At the same time, the domain-specific knowledge base, as another key component, contains professional knowledge and data related to a specific field, which is used to further verify the accuracy of the new proposition. Once the language model module completes the preliminary semantic analysis and marks the potential errors, this information will be sent to the knowledge verification module, which uses the data in the domain-specific knowledge base to confirm or deny these potential errors. If errors are found in the new proposition, the system will submit these errors together with the original new proposition to the error correction algorithm module. The error correction algorithm module automatically corrects the errors in the new proposition based on the received information and the previous analysis results and verification feedback, and generates a corrected proposition. Finally, the corrected new proposition is output. The whole process realizes an automated process from receiving new propositions to outputting accurate propositions, ensuring the quality and accuracy of the content generated by the large model. This series of steps not only improves processing efficiency, but also ensures the professionalism and reliability of the final output content.
[0142] The step S3 specifically includes:
[0143] Extract relevant data from a predefined domain-specific knowledge base that contains facts, rules, logical relationships, and domain-specific concepts.
[0144] Let the knowledge base be K, the new proposition be P,
[0145] For each sub-proposition Pi in P, find the set of propositions {k1, k2, ..., kn} in K that is closest to Pi in semantics.
[0146] Calculate the similarity between proposition Pi and the corresponding proposition Kj in K , using the cosine similarity formula: ,
[0147] in, and is the semantic vector representation of the corresponding proposition;
[0148] According to the rules and logic in the knowledge base, the logical consistency of the new proposition and the known knowledge is verified, the overall accuracy of the new proposition PPP is evaluated, and the similarity and logical consistency of each sub-proposition are comprehensively considered to obtain the confidence score C(P) of the new proposition:
[0149] ,
[0150] in, is the logical consistency score.
[0151] In this embodiment, the error correction method analyzes each sub-proposition in the new proposition by utilizing data in a domain-specific knowledge base. First, the similarity between the sub-proposition Pi and the knowledge base proposition Kj is calculated by extracting the set of propositions {k1, k2, …, kn} closest to each sub-proposition Pi from the knowledge base K. This similarity is calculated using the cosine similarity formula to ensure accurate quantification of the semantic relationship between propositions. Next, the method verifies the logical consistency of the new proposition with the existing knowledge in the knowledge base based on predefined rules and logic. By combining the semantic similarity and logical consistency of the sub-propositions, the method is able to calculate the confidence score C(P) of the new proposition, which reflects the overall accuracy of the new proposition and its consistency with the known information in the knowledge base.
[0152] This implementation effectively improves the verification accuracy of the new proposition by comparing each sub-proposition of the new proposition with the propositions in the domain-specific knowledge base. By calculating the similarity and logical consistency of the sub-propositions, the method can comprehensively evaluate the overall accuracy of the new proposition and derive a reliable confidence score. This process ensures the logical and semantic consistency of the new proposition, thereby improving the accuracy and reliability of the error correction process.
[0153] In this embodiment, different types of similarity calculation methods, such as Euclidean distance, Jaccard similarity coefficient, etc., can be selected to replace cosine similarity and adjusted according to the needs of different application scenarios. In addition, the construction method of the knowledge base K can also be changed, such as introducing more field-specific corpora or enhancing the dynamic update capability of the knowledge base to adapt to the ever-changing knowledge system. The calculation method of the final confidence score C(P) can also be optimized through different logical rules or weight adjustments to further improve the accuracy of error correction.
[0154] The step S4 specifically includes:
[0155] Based on the similarity and logical consistency results in step S3, determine the location of the error in the proposition and locate the error point of each sub-proposition Pi. If Less than the preset threshold , then the sub-proposition is considered to be wrong;
[0156] Use the correct proposition set {k1, k2, ..., kn} in the domain-specific knowledge base to correct errors, use the replacement strategy, select the proposition Kj with the highest similarity to Pi and the best logical consistency to replace the erroneous part of Pi, and the corrected proposition for:
[0157] ;
[0158] The revised new proposition Verify the knowledge base again to ensure the consistency of its semantics and logic. If the revised proposition still does not meet the conditions, further adjustments are made until the confidence level of the proposition reaches Reach the set threshold.
[0159] In this embodiment, the error correction method first identifies the error position in the new proposition through the similarity and logical consistency results obtained in the previous step. When the similarity of the sub-proposition Pi is lower than the preset threshold, the system will determine that the sub-proposition may contain errors. Next, the method uses a replacement strategy to select the proposition Kj that is most similar to Pi and has the best logical consistency in the correct proposition set in the knowledge base K for replacement, and generates a corrected proposition P'. After that, the corrected proposition P' is verified again through the knowledge base to ensure its semantic and logical consistency. If the corrected proposition still does not meet the preset confidence requirements, it will be further adjusted until the corrected proposition meets the conditions. This embodiment can effectively locate and correct errors in the proposition, and ensures the effectiveness of the replacement strategy by combining the analysis of similarity and logical consistency. After the revised proposition is verified again, its semantic and logical consistency can be guaranteed, thereby improving the accuracy and efficiency of error correction. Through this process, the impact of erroneous propositions on subsequent reasoning and decision-making can be greatly reduced, and the overall reliability of the knowledge base system can be improved.
[0160] In this implementation, the preset similarity threshold or logical consistency standard can be adjusted according to different application scenarios to adapt to different error correction requirements. In addition, the replacement strategy can also introduce more intelligent adjustment mechanisms, such as dynamically optimizing the weights of similarity calculation and logical consistency analysis through machine learning algorithms to further improve the accuracy and efficiency of the correction process. If the knowledge base K has a self-learning function, the proposition set can be automatically updated during the error correction process to improve the system's ability to handle new propositions.
[0161] A system for correcting errors of new propositions based on a large model is also provided, which is used to implement the steps of the method for correcting errors of new propositions based on a large model, and the system comprises:
[0162] A context information acquisition module, which is used to acquire new propositions generated by the large model and their corresponding context information;
[0163] A semantic analysis module, which performs semantic analysis on new propositions based on a pre-trained language model to identify potential errors in new propositions;
[0164] A verification module that verifies the accuracy of new propositions using a domain-specific knowledge base;
[0165] The correction module automatically corrects errors in new propositions based on semantic analysis results and verification feedback.
[0166] The context information acquisition module is used to receive and process new propositions and their related context information generated by the big model. This module captures the sentences output by the big model through a dialogue or text generation system and extracts the relevant context to ensure the accuracy of subsequent processing.
[0167] The semantic analysis module performs deep semantic analysis on new propositions through pre-trained language models. This module identifies potential errors in new propositions, including but not limited to grammatical errors, logical contradictions, or semantic inconsistencies. The core of the semantic analysis module is to use the contextual understanding ability of the language model to conduct a comprehensive analysis of the semantics of the new proposition to ensure its logical and grammatical integrity.
[0168] The verification module verifies the content of the new proposition by calling domain-specific knowledge bases. These knowledge bases may contain recognized standards, rules, or known facts in the domain. This module is responsible for checking whether the new proposition is consistent with the known knowledge in the domain and marking potential inaccuracies.
[0169] The correction module automatically corrects errors in new propositions based on semantic analysis results and verification feedback. The correction process relies on the model's understanding of semantics and combines the results of verification in the domain knowledge base to generate a new proposition that is corrected and consistent with the context and domain knowledge. The context information acquisition module can also adopt different acquisition strategies, such as collecting context information through real-time monitoring of multiple sources (such as document generation systems, dialogue agents). In addition, the semantic analysis module can use different pre-trained language models according to different application scenarios to adapt to specific language styles or domain requirements. The verification module can also combine multiple knowledge bases, or use external APIs for verification when there is a lack of knowledge base support. The correction module can also combine manual intervention to allow users to review and confirm suggestions before automatic correction.
[0170] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A new proposition error correction method based on a large model, characterized in that: The method comprises: S1: Obtain the generated new proposition and its corresponding context information; S2: Perform semantic analysis on new propositions based on the pre-trained language model to identify potential errors; S3: Use domain-specific knowledge base to verify the accuracy of the new proposition; S4: Automatically correct errors in new propositions based on analysis results and verification feedback; The step S1 of obtaining the generated new proposition and its corresponding context information specifically includes: Receive the output new proposition text through the API interface; Extract key words from new proposition text; Build context based on key words; Use natural language processing techniques to identify entities and relations in new propositions; The calculation of the similarity S between the new proposition and the standard expression in the field based on the semantic vector representation specifically includes: Normalize the semantic vector representation of the new proposition; Calculate the cosine similarity C between the normalized semantic vector representation and the standard expression vector representation in the field; If the cosine similarity C is less than 0.7, it is considered that the new proposition does not match the standard statement, that is, when C<0.7, it is determined that there is a large difference between the new proposition and the standard statement; Adjust the calculation method of similarity S based on the mismatch situation; The specific steps of calculating the cosine similarity C between the normalized semantic vector representation and the standard expression vector representation in the field include: Determine the semantic vector representation V1 of the new proposition and the vector representation V2 of the standard statement; Calculate the dot product P of V1 and V2; Calculate the modulus lengths M1 and M2 of V1 and V2; Calculate the cosine similarity according to the formula cosine similarity C=P / (M1×M2); The step S3 specifically includes: Extract relevant data from a predefined domain-specific knowledge base that contains facts, rules, logical relationships, and domain-specific concepts; Let the knowledge base be K, the new proposition be P, For each sub-proposition Pi in P, find the set of propositions {k1, k2, ..., kn} in K that is closest to Pi in semantics. Calculate the similarity between proposition Pi and the corresponding proposition Kj in K , using the cosine similarity formula: , in, and is the semantic vector representation of the corresponding proposition; According to the rules and logic in the knowledge base, verify the logical consistency of the new proposition with the known knowledge, evaluate the overall accuracy of the new proposition P, and comprehensively consider the similarity and logical consistency of each sub-proposition to obtain the confidence score C(P) of the new proposition: , in, is the logical consistency score.
2. A method for correcting new questions based on a large model according to claim 1, characterized in that: The step of performing semantic analysis on the new proposition based on the pre-trained language model in step S2 specifically includes: Input the new proposition into the pre-trained language model to obtain a semantic vector representation; Calculate the similarity S between the new proposition and the standard expression in the field based on the semantic vector representation; If the similarity S is lower than the preset threshold T, it is determined that the new proposition may have semantic errors; Compare the key differences between the new proposition and the standard statements in the field.
3. The method for correcting errors in new propositions based on a large model according to claim 1 is characterized in that: In step S2, the semantic analysis of the new proposition is performed based on the pre-trained language model to identify potential errors therein. The specific steps of the recognition process include: Obtaining lexical structure information of new propositions; Calculate the grammatical probability score P(grammar) of the new proposition based on the language model; Determine whether the grammar probability score P(grammar) is lower than a first preset threshold θ1; If P(grammar) < θ1, then the recognition of the new proposition may contain grammatical errors; The specific steps of calculating the grammatical probability score P(grammar) of the new proposition based on the language model include: Perform word segmentation on the new proposition to obtain a vocabulary sequence; Calculate a probability score P(vocabulary) of the vocabulary sequence based on a language model; Calculate the context relevance score P(context) of the new proposition; The grammatical probability score P(grammar) is calculated according to the formula P(grammar) = P(vocabulary) × P(context).
4. A method for correcting errors in new propositions based on a large model according to claim 3, characterized in that: The specific steps of calculating the context relevance score P(context) of the new proposition include: Obtaining context information of the new proposition; Calculate the relevance scores P(previous) and P(next) of the context information based on the language model; Determine whether the correlation scores P(front) and P(back) are both higher than a second preset threshold θ2; If P(pre) > θ2 and P(post) > θ2, then P(context) = (P(pre) + P(post)) / 2; The specific steps of calculating the relevance scores P(previous) and P(after) of the context information based on the language model include: Extract the keywords of the context of the new proposition; Calculate the probability P(keyword) of the keyword appearing in the context based on the language model; Calculate the semantic similarity S (semantic) between the keyword and the new proposition; The relevance scores P(front) and P(back) are calculated according to the formula P(front) / P(back) = P(keyword) × S(semantic).
5. A method for correcting errors in new propositions based on a large model according to claim 4, characterized in that: The specific steps of calculating the semantic similarity S (semantics) between the keyword and the new proposition include: The keywords and new propositions are vectorized into vectors V keywords and V new propositions respectively; Calculate the cosine similarity COS between the vector V keyword and V new proposition; If COS>the third preset threshold θ3, then S(semantic)=COS.
6. The method for correcting errors in new propositions based on a large model according to claim 1, characterized in that: The step S4 specifically includes: Based on the similarity and logical consistency results in step S3, determine the location of the error in the proposition and locate the error point of each sub-proposition Pi. If Less than the preset threshold , then the sub-proposition is considered to be wrong; Use the correct proposition set {k1, k2, ..., kn} in the domain-specific knowledge base to correct errors, use the replacement strategy, select the proposition Kj with the highest similarity to Pi and the best logical consistency to replace the erroneous part of Pi, and the corrected proposition for: ; The revised new proposition Verify the knowledge base again to ensure the consistency of its semantics and logic. If the revised proposition still does not meet the conditions, further adjustments are made until the confidence level of the proposition reaches Reach the set threshold.
7. A system for correcting new propositions based on a large model, used to implement the steps of the method for correcting new propositions based on a large model according to any one of claims 1 to 6, characterized in that: The system comprises: A context information acquisition module, which is used to acquire the generated new proposition and its corresponding context information; Semantic analysis module, which performs semantic analysis on new propositions based on a pre-trained language model and identifies potential errors in new propositions; A verification module that verifies the accuracy of new propositions using a domain-specific knowledge base; The correction module automatically corrects errors in new propositions based on semantic analysis results and verification feedback.
Citation Information
Patent Citations
Semantic error correction method, electronic equipment and storage medium
CN113139387A