Mathematical reasoning method for large language model based on retelling quality optimization

By integrating multi-index scoring and pairwise comparison methods, the best retellings are selected and input into the large language model as prompts, which solves the problem of poor performance of the model in mathematical reasoning and significantly improves the accuracy of mathematical question and answer tasks.

CN118674053AActive Publication Date: 2024-09-20HANGZHOU DIANZI UNIV

Patent Information

Application Number
CN202411170996.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-09-20
Estimated Expiration
2044-08-26

AI Technical Summary

Technical Problem

Large language models have weak performance in mathematical reasoning and logical reasoning, and are difficult to effectively understand and process mathematical problems, resulting in poor performance in mathematical question and answer tasks.

Method used

A mathematical problem retelling quality assessment method that combines multi-index scoring and pairwise comparison is used to select the best retellings through the XGBoost classifier, thereby improving the mathematical reasoning ability of large language models. This method combines the evaluation indicators of the text summary task and forms a partial order relationship through multiple comparisons to ensure that the relative rankings between retellings are clear. Finally, the best selected retellings are used as the Prompt input model for answer generation.

Benefits of technology

It effectively improves the response quality of large language models on mathematical questions. Experimental results show that the accuracy on the GSM8K test set increased by 2.28%, reaching 86.81%, which significantly improved the model's performance in mathematical question and answer tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674053A
    Figure CN118674053A
Patent Text Reader

Abstract

The invention relates to a large language model mathematical reasoning method based on retelling quality optimization, the mathematical reasoning ability of a large language model is improved through high-quality problem retelling, a multi-index scoring module and a pairwise comparison module are fused in the scheme, the former determines an optimal prompt mode through experiments from six perspectives, and the mathematical reasoning ability of the large language model is improved through high-quality problem retelling. Performing single-index scoring on the retelling quality by using a large language model; and the multi-index scoring module carries out relative ranking among the reviews by using a large language model according to the comprehensive quality of the reviews, finally trains a gradient boosting decision tree classification model, takes the score of the multi-index scoring module and the relative relationship of the pairwise comparison module as feature input, decides and selects an optimal review. The invention provides a general evaluation framework for retelling quality evaluation by using a large language model, and the performance of the model on mathematical problems is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a large language model mathematical reasoning method based on repetition quality optimization, which can effectively evaluate the quality of the repetition of mathematical problems and improve the performance of the model on mathematical reasoning datasets, belonging to the field of natural language processing technology. Background Art

[0002] Large language models (LLMs) have demonstrated outstanding performance in many downstream tasks in natural language processing (NLP), but they are not equally adept at all tasks. LLMs typically excel in downstream tasks such as text summarization, sentiment analysis, question-answering systems, and language translation, while performing somewhat worse in logical reasoning and mathematical question answering. The former requires LLMs to understand grammar and semantics, extract information, and generate coherent text; the latter places higher demands on the model's logical reasoning capabilities.

[0003] Prompts provided by humans significantly influence the language model's response. Zero-shot CoT (CoT) adds special prompts to enable the model to generate its own reasoning path. In-Context Learning (ICL) has also demonstrated that adding examples to prompts can influence model output. Different examples also influence ICL performance. This demonstrates the crucial impact of prompts on LLMs. Whether an LLM can accurately and comprehensively understand prompts directly impacts the quality of its response.

[0004] Relevant research shows that there is a discrepancy between the LLM's understanding of prompts and the true intention of human input. Therefore, some work is dedicated to guiding language models to align with human preferences, such as reinforcement learning from human feedback (RLHF), reinforcement learning from AI feedback (RLAIF), and direct preference optimization (DPO). Other work takes the opposite approach and optimizes prompts to adapt to LLM's understanding, such as using language models as prompt optimizers (OPRO), iteratively optimizing prompts using actor-critic models (PACE), and training small models to optimize prompts (BPO).

[0005] The introduction of Rephrase+Respond (RaR) allows the large language model to restate the input question and then answer it, which can improve the performance of LLM in downstream tasks to a certain extent: the language model may have misunderstandings about the original input, and the restated question will tend to enhance semantic clarity and add additional details, which is conducive to solving the original problem.

[0006] Effective evaluation methods are crucial for improving model performance. Related research has demonstrated that LLMs can be effective evaluators. For example, using GPT-4 to evaluate responses generated by small models, which are typically trained with RLHF, demonstrates strong human alignment, making it a viable alternative to human evaluation. For example, in the text summarization task, G-Eval proposes an excellent evaluation framework that, combined with carefully designed prompts, demonstrates good human alignment.

[0007] LLM's effective evaluation of text generation tasks has greatly promoted the development of this task and demonstrated its outstanding capabilities in the field of text generation. In contrast, due to the relatively weak reasoning ability of language models, they perform poorly in solving mathematical problems. Summary of the Invention

[0008] To overcome the shortcomings of existing research, this paper proposes a mathematical reasoning method for large language models based on paraphrase quality optimization. This approach aims to leverage the strengths of LLMs in text generation and improve their performance in areas where they are weaker, such as math question answering. By paraphrasing math problems, a connection can be established with text generation tasks: a high-quality paraphrase can enhance the LLM's understanding of the input prompt, while also supplementing and emphasizing the original problem, indirectly improving the model's performance on math question answering tasks.

[0009] The innovation of the present invention lies in proposing a method for evaluating the quality of mathematical problem repetition that integrates multi-index scoring and paired comparison, aiming to optimize the selection of the best repetition, thereby improving the mathematical reasoning ability of the large language model through high-quality problem repetition. Multi-index scoring can comprehensively consider multiple evaluation indicators, and the evaluation angle is more comprehensive, but there is also the possibility of score fluctuations; paired comparison can intuitively compare the comprehensive quality of the repetition and perform relative ranking, but it cannot achieve a comprehensive evaluation. Therefore, the present invention adopts a fusion strategy, comprehensively uses multi-index scoring and paired comparison, and combines the XGBoost classifier to make the final decision to select the best repetition.

[0010] In the multi-metric scoring module, considering the similarities between paraphrasing and text summarization tasks, the present invention referenced the evaluation metrics proposed by G-Eval for the text summarization task, optimized and adapted them, and based on this, expanded some evaluation metrics more suitable for mathematical problems. In the paired comparison module, the present invention uses a multiple comparison and integration method to compare paraphrases pairwise to determine their relative ranking and form a partial order. Ultimately, the outputs of these two modules serve as the input to the decision module to screen out the best paraphrases.

[0011] The specific steps of a large language model mathematical reasoning method based on retelling quality optimization are as follows:

[0012] Step 1: Select a math problem from the dataset, construct a prompt, and generate multiple paraphrases using LLM;

[0013] Step 2: Set six evaluation indicators for retelling quality assessment: coherence, consistency, fluency, relevance, matching, and logic. Experiment with different prompts for each indicator to more effectively evaluate its performance.

[0014] Step 3: Combine the six indicators and their corresponding prompts in step 2, use LLM to perform multi-indicator scoring on each repetition, and use the mean probability of the output token as the score to ensure its discrimination;

[0015] Step 4: Use LLM to compare all repetitions in pairs. By accumulating scores over multiple comparisons, the relative relationships between repetitions are obtained. To this end, the results of the pairwise comparisons should satisfy a partial order relationship to ensure that the relative rankings between repetitions are clear.

[0016] Step 5: Train a classifier as a decision model. This involves the following steps: preprocess the training set to identify samples with optimal paraphrases; use these samples to execute steps 1 to 4 to obtain the model's input features and labels; select the gradient boosting tree algorithm for classification and use XGBoost to train the classifier for the final decision.

[0017] Step 6: Input the scores of the multi-index scoring module in step 3 and the integral of the pairwise comparison module in step 4 into the trained decision module to obtain the decision result, which is selected as the best repetition;

[0018] Step 7: Use the best selected retelling combined with the original question as the prompt, and input it to GPT-3.5 in the form of zero-shot thinking chain (Zero-shot CoT) combined with self-consistency check (SC) to obtain the answer to the question.

[0019] The step 1 specifically includes: selecting a mathematical problem q from the data set and constructing a prompt for the problem , use LLM to generate n paraphrases , the generated i-th retelling can be expressed as:

[0020] .

[0021] The evaluation indicators in step 2 are: referring to the evaluation method of the text summarization task, four indicators are set as evaluation indicators of retelling quality: coherence (Coh), consistency (Con), fluency (Flu) and relevance (Rel); considering the characteristics of mathematical problems, two additional evaluation indicators that are more suitable for mathematical tasks are added: matching (Mat) and logic (Log).

[0022] The prompt types are: no metric, standard prompt (Standard), standard prompt + evaluation criteria (Standard+Criteria), and standard prompt + evaluation criteria + evaluation steps (Standard+Criteria+Steps). The standard prompt includes the current task objective, constraints, the original math problem, the restatement to be evaluated, and the output template; the evaluation steps are automatically generated by GPT-4.

[0023] Four prompting methods are applied to six evaluation indicators respectively, and their impact on the accuracy of the dataset is observed to determine the best prompting method for each indicator. For different datasets of math question answering tasks, the prompting method selected for each indicator may be different, and the specific selection should be determined through experiments based on the dataset. The prompting method corresponding to each evaluation indicator can be expressed as:

[0024] .

[0025] The step three specifically includes:

[0026] Combined with the six indicators and their corresponding prompts in step 2, LLM is used to perform multiple-indicator scoring on each retelling, with a scoring range of 1-5. Taking the Coh indicator as an example, LLM scores the retelling A single score under this indicator can be expressed as .

[0027] Directly using the model output as the scoring result may result in a small degree of discrimination in the scoring. This solution uses the probability mean of the model output token as the single indicator score of the LLM for the current repetition. Specifically, the language model output score is The probability of , then repeat The final score of indicator Coh can be expressed as:

[0028] .

[0029] For LLMs such as GPT-4 that do not provide token output probability, we can use the average of multiple scores to simulate. Taking the Coh score as an example, LLM is used to score K times to obtain the score set ,in and , represents the output score of the model for the kth time. The number of times the output score is t in the score set S is , you can use To simulate the probability that the LLM output score is t Therefore, retell The final score of indicator Coh can be expressed as:

[0030] .

[0031] The step 4 specifically includes:

[0032] Use LLM to compare all the repetitions in pairs, using a circular comparison method, that is, each repetition needs to be compared with other alternative repetitions once, so a total of n repetitions will form A comparison group. and retelling The comparison can be expressed as ,in Indicates specific prompts for pairwise comparisons.

[0033] Because there is a position bias in paired comparisons, that is, LLM will favor the repetition that comes first in the prompt, this scheme will compare each comparison group 5 times in sequence, swap the order of the two, and then compare them 5 times to reduce the impact of position bias on the results. For each comparison, LLM will select the repetition with better overall performance, and this repetition will receive 2 points; if the two repetitions are tied, each will receive 1 point. and The integrals obtained after comparison are expressed as and .

[0034] After a round of effective pairwise comparisons, a clear partial order relationship should be formed between the repetitions, that is, the following constraints should be met, and the superiority and inferiority relationship between the repetitions can form a directed acyclic Hasse graph;

[0035]

[0036] If the paraphrases do not satisfy the above constraints, the comparison should be considered self-contradictory, and the contradictory parts should be re-compared. Specifically, the superiority relationship between the paraphrases is transformed into a directed graph. Parts that do not satisfy the above constraints will form loops in the graph. Use topological sorting to remove all points with zero in-degree and zero out-degree. The remaining parts that cannot be removed are all the paraphrases that need to be re-compared.

[0037] The step five specifically includes:

[0038] The decision module evaluates and makes decisions based on the output of the multi-metric scoring module and the results of the pairwise comparison module, selecting one of the n retellings as the best retelling. It is essentially a classification model, and the training process is as follows:

[0039] 5.1 Sample Selection: Use LLM to generate n paraphrases for each sample in the training set , respectively, combined with the original question, use the Zero-shot CoT+SC method to respond T times, generate T answers, and record the number of correct answers as ,but Corresponding to .

[0040] Restatement of the definition of this plan A paraphrase is an optimal paraphrase if and only if it satisfies the following conditions:

[0041]

[0042] Based on the above definition, samples with the best repetition are selected from the training set as training samples for the decision module.

[0043] 5.2 Obtain input features and labels: Perform steps 1 to 4 on the above-screened training samples in sequence, and obtain the scoring results from the multi-index scoring module , get the integral results from the pairwise comparison module , taking the above two as the input features of the model; taking the index of the best repetition as the label, it can be expressed as: , used to train the decision module.

[0044] 5.3 Model selection: The decision module of the solution uses the XGBoost algorithm to implement the classifier. Scoring results and This approach uses the integral results as input features and selects the best repetition from n repetitions. Essentially, it is a classification model. Given the large dimensionality of the model's input features, the Gradient Boosted Tree (GBDT) algorithm is proposed for classification. It effectively handles high-dimensional data and complex feature relationships. Furthermore, XGBoost is an implementation and optimization of the GBDT algorithm, introducing regularization terms and using a more complex tree structure to improve model performance and training speed. Therefore, this solution selected XGBoost as the final model and trained it to obtain the decision module.

[0045] 5.4 Optimize input features: The difference between the multi-index scores between repetitions and the difference between the integrals of the pairwise comparisons are used as the input features of the model, which reduces the feature dimension while increasing the interpretability of the feature. and As input features, the feature dimension is effectively reduced to .

[0046] The step six specifically includes:

[0047] The trained decision module can be obtained from step five, and the score of the multi-index scoring module in step three is After feature optimization, it can be transformed into , the integral of the pairwise comparison module in step 4 After feature optimization, it can also be transformed into , input the decision module trained in step 5, and get the prediction of the best repetition .

[0048] The step seven specifically includes:

[0049] Use the best selected paraphrases Combined with the original question q as a hint, the zero-shot thinking chain (Zero-shot CoT) combined with the self-consistency check (SC) is input to the LLM to get the answer to the question. Indicates a specific prompt: .

[0050] Compared with the prior art, the present invention has the following beneficial effects:

[0051] This paper proposes an automated mathematical question-answering evaluation and decision-making scheme based on a large language model (LLM). This scheme provides a universal evaluation framework for evaluating the quality of mathematical paraphrases using LLMs, with good scalability and adaptability. This scheme integrates multi-metric scoring and pairwise comparison modules, balancing comprehensiveness and integrativeness. A decision model is trained on this basis, leveraging the strengths of both to effectively select the best paraphrases and, consequently, improve the quality of LLM responses to the original questions.

[0052] Experimental results demonstrate that this method effectively deepens the language model's understanding of the original problem. On the GSM8K test set, GPT-3.5 combined with this method achieved an accuracy of 86.81%, a 2.28% improvement over the Zero-shot CoT+SC baseline. This approach is leading the way among methods using GPT-3.5 as a base model. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0054] Figure 1 This is a flow chart of a large language model mathematical reasoning method based on repetition quality optimization according to the present invention;

[0055] Figure 2 Schematic diagram of the multi-index scoring module of the present invention;

[0056] Figure 3 Schematic diagram of the pairwise comparison module of the present invention;

[0057] Figure 4 Schematic diagram of the decision module of the present invention;

[0058] Figure 5 Prompt diagram used when generating retelling and generating answers for the present invention;

[0059] Figure 6 This is a Prompt chart used in the multi-index scoring and pairwise comparison of the present invention. DETAILED DESCRIPTION

[0060] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts are within the scope of protection of the present invention.

[0061] like Figure 1 As shown in FIG, the specific steps of a large language model mathematical reasoning method based on repetition quality optimization are as follows:

[0062] Step 1: Select a math problem, construct a prompt, and use LLM to generate multiple paraphrases.

[0063] Step 2: Set six evaluation indicators, including coherence, consistency, fluency, relevance, matching, and logic, for retelling quality assessment; through experiments, set different prompt methods for each indicator to more effectively exert the evaluation performance of each indicator.

[0064] Step 3: Combine the six indicators and their corresponding prompts in step 2, use LLM to perform multi-indicator scoring on each repetition, and use the average probability of the output token as the score to ensure its discrimination. The schematic diagram of the multi-indicator scoring module is as follows Figure 2 shown.

[0065] Step 4: Use LLM to compare all repetitions in pairs. By accumulating scores through multiple comparisons, the relative relationship between repetitions can be obtained. To this end, the results of the pairwise comparisons should satisfy the partial order relationship to ensure that the relative rankings between repetitions are clear. Figure 3 shown.

[0066] Step 5: Train a classifier as a decision model, which includes the following steps: preprocess the training set data to screen the samples with the best repetition; use the above samples to execute steps 1 to 4 to obtain the input features and labels of the model; select the gradient boosting tree algorithm to implement the classification task, and use XGBoost to train the classifier for the final decision. The decision module is as follows: Figure 4 shown.

[0067] Step 6: Input the scores of the multi-index scoring module in step 3 and the integral of the pairwise comparison module in step 4 into the trained decision module to obtain the decision result, which is selected as the best repetition.

[0068] Step 7: Use the best selected restatement combined with the original question as a prompt, and input it into the LLM in the form of zero-shot thinking chain (Zero-shot CoT) combined with self-consistency check (SC) to obtain the answer to the question.

[0069] The specific implementation process of step 1 is as follows:

[0070] Pick a math problem q from the dataset and construct a prompt for that problem Specific prompts such as Figure 5 As shown, use LLM to generate n paraphrases , the generated i-th retelling can be expressed as:

[0071]

[0072] The specific implementation process of step 2 is as follows:

[0073] This paper uses the evaluation method of text summarization tasks as a reference and sets four indicators as evaluation metrics for paraphrase quality: coherence (Coh), consistency (Con), fluency (Flu), and relevance (Rel). Taking into account the characteristics of mathematical problems, this solution adds two additional evaluation indicators that are more suitable for mathematical tasks: matching (Mat) and logic (Log).

[0074] Recent research has explored the impact of LLM prompts on text summarization tasks, pointing out that the evaluation quality of LLM fluctuates under different prompts. Based on this, this paper proposes a standard prompt (Standard), which includes the current task goal, constraints, the original mathematical problem, the restatement to be evaluated, and the output template; in addition, it also designs evaluation criteria (Criteria) and evaluation steps (Steps) for each of the six evaluation indicators. The evaluation steps are automatically generated by GPT-4, following the G-Eval model. The prompt details are as follows: Figure 6 shown.

[0075] On this basis, this scheme proposes four prompting methods, namely: not using this indicator, using standard prompts (Standard), standard prompts + evaluation criteria (Standard+Criteria), and standard prompts + evaluation criteria + evaluation steps (Standard+Criteria+Steps); these four prompting methods are applied to the six evaluation indicators respectively, and their impact on the accuracy of the data set is observed to determine the best prompting method for each indicator.

[0076] For different datasets of math question-answering tasks, the prompt method selected for each indicator may be different. The specific selection should be determined through experiments based on the dataset. Taking the GSM8K dataset as an example, the three indicators of coherence, matching, and logic use the prompt method of Standard+Criteria+Steps, the consistency indicator uses Standard+Criteria, and the fluency indicator uses only the Standard prompt method and abandons the use of the relevance indicator. Therefore, the prompt method corresponding to each evaluation indicator can be expressed as follows:

[0077]

[0078] The specific implementation process of step three is as follows:

[0079] Combined with the six indicators and their corresponding prompts in step 2, LLM is used to perform multiple-indicator scoring on each retelling, with a scoring range of 1-5. Taking the Coh indicator as an example, LLM scores the retelling A single score under this indicator can be expressed as .

[0080] Directly using the model output as the scoring result may result in a small degree of discrimination in the scoring. This solution uses the probability mean of the model output token as the single indicator score of the LLM for the current repetition. Specifically, the language model output score is The probability of , then repeat The final score of indicator Coh can be expressed as:

[0081]

[0082] For LLMs such as GPT-4 that do not provide token output probability, we can use the average of multiple scores to simulate. Taking the Coh score as an example, LLM is used to score K times to obtain the score set ,in and , represents the output score of the model for the kth time. The number of times the output score is t in the score set S is , you can use To simulate the probability that the LLM output score is t Therefore, retell The final score of indicator Coh can be expressed as:

[0083]

[0084] The specific implementation process of step 4 is as follows:

[0085] Use LLM to compare all the repetitions in pairs, using a circular comparison method, that is, each repetition needs to be compared with other alternative repetitions once, so a total of n repetitions will form Specific tips for pairwise comparisons like Figure 6 Shown, retell and retelling The comparison can be expressed as .

[0086] Because there is a position bias in paired comparisons, that is, LLM will favor the repetition that comes first in the prompt, this scheme will compare each comparison group 5 times in sequence, swap the order of the two, and then compare them 5 times to reduce the impact of position bias on the results. For each comparison, LLM will select the repetition with better overall performance, and this repetition will receive 2 points; if the two repetitions are tied, each will receive 1 point. and The integrals obtained after comparison are expressed as and .

[0087] After a round of effective pairwise comparison, a clear partial order relationship should be formed between the repetitions, that is, the following constraints should be met, and the superiority and inferiority relationship between the repetitions can form a directed acyclic Hasse graph.

[0088]

[0089] If the paraphrases do not satisfy the above constraints, the comparison should be considered self-contradictory, and the contradictory parts should be re-compared. Specifically, the superiority relationship between the paraphrases is transformed into a directed graph. Parts that do not satisfy the above constraints will form loops in the graph. Use topological sorting to remove all points with zero in-degree and zero out-degree. The remaining parts that cannot be removed are all the paraphrases that need to be re-compared.

[0090] The specific implementation process of step 5 is as follows:

[0091] The decision module is a one-out-of-n decision classification model. It evaluates and makes decisions based on the output of the multi-metric scoring module and the results of the pairwise comparison module, selecting one of the n retellings as the best. It is essentially a classification model, and the training process is as follows:

[0092] 5.1 Sample selection. Use LLM to generate n repetitions for each sample in the training set. , respectively, combined with the original question, use the Zero-shot CoT+SC method to respond T times, generate T answers, and record the number of correct answers as ,but Corresponding to .

[0093] Restatement of the definition of this plan A paraphrase is an optimal paraphrase if and only if it satisfies the following conditions:

[0094]

[0095] Based on the above definition, samples with the best repetition are selected from the training set as training samples for the decision module.

[0096] 5.2 Obtain input features and labels. Perform steps 1 to 4 on the above-screened training samples and obtain the scoring results from the multi-index scoring module. , get the integral results from the pairwise comparison module , taking the above two as the input features of the model; taking the index of the best repetition as the label, it can be expressed as: , used to train the decision module.

[0097] 5.3 Model selection. The decision module of this solution uses the XGBoost algorithm to implement the classifier. Scoring results and This approach uses the integral results as input features and selects the best repetition from n repetitions. Essentially, it is a classification model. Given the large dimensionality of the model's input features, the Gradient Boosted Tree (GBDT) algorithm is proposed for classification. It effectively handles high-dimensional data and complex feature relationships. Furthermore, XGBoost is an implementation and optimization of the GBDT algorithm, introducing regularization terms and using a more complex tree structure to improve model performance and training speed. Therefore, this solution selected XGBoost as the final model and trained it to obtain the decision module.

[0098] 5.4 Optimize input features. In terms of input features, the difference between the multi-index scores between repetitions and the difference between the integrals of the pairwise comparisons are used as the input features of the model, which reduces the feature dimension while increasing the interpretability of the feature. and As input features, the feature dimension is reduced to .

[0099] The specific implementation process of step six is ​​as follows:

[0100] The trained decision module can be obtained from step five, and the score of the multi-index scoring module in step three is After feature optimization, it can be transformed into , the integral of the pairwise comparison module in step 4 After feature optimization, it can also be transformed into , input the decision module trained in step 5, and get the prediction of the best repetition .

[0101] The specific implementation process of step seven is as follows:

[0102] Use the best selected paraphrases Combined with the original question q as a hint, the zero-shot thinking chain (Zero-shot CoT) combined with the self-consistency check (SC) is input to the LLM to get the answer to the question. The specific hint is like Figure 5 shown.

[0103]

[0104] Experimental results:

[0105] This paper uses GPT-3.5 as its base model and tests it on the GSM8K math problem dataset. Using Zero-shot CoT+SC as the baseline, the experimental accuracy on the GSM8K test set was 84.53%. Furthermore, by generating three replies for each question and combining this proposed automatic math question-answering evaluation and decision-making solution with the best replies screened, Zero-shot CoT+SC was used to generate the answer. This improved the accuracy of GPT-3.5 on the test set to 86.81%, a 2.28% improvement over the previous approach.

[0106] Experiments show that generating paraphrases based on mathematical problems and screening the best paraphrases through multi-index scoring + pairwise comparison + decision module can effectively improve the performance of LLM on mathematical problem datasets.

[0107] The embodiments of the present invention are described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. It is apparent to those skilled in the art that various changes, modifications, substitutions, and variations to these embodiments may be made without departing from the principles and spirit of the present invention, and these changes and modifications still fall within the scope of protection of the present invention.

Claims

1. A mathematical reasoning method for a large language model based on repetition quality optimization, characterized by: The following steps are involved: Step 1: Select a math problem from the dataset, construct a prompt, and generate multiple paraphrases using LLM; Step 2: Set six evaluation indicators, namely, coherence, consistency, fluency, relevance, matching and logic, for retelling quality evaluation; set different prompts for each indicator through experiments to give full play to the evaluation performance of each indicator; Step 3: Combine the six indicators in step 2 and their corresponding prompts, use LLM to perform multi-indicator scoring on each repetition, and use the average probability of the output token as the score; Step 4: Use LLM to compare all repetitions in pairs, and obtain the relative relationship between repetitions by accumulating scores through multiple comparisons; Step 5: Train a classifier as a decision model, which includes the following processes: preprocess the training set and select the samples with the best repetition; use the above samples to execute steps 1 to 4 to obtain the input features and labels of the model; select the gradient boosting tree algorithm to implement the classification task, and use XGBoost to train the classifier to achieve the final decision; Step 6: Input the scores after multi-index scoring in step 3 and the scores after pairwise comparison in step 4 into the trained decision module to obtain the decision result, which is selected as the best repetition; Step 7: Use the best selected restatement combined with the original question as the prompt, and input it into GPT-3.5 in the form of zero-sample thinking chain combined with self-consistency check to obtain the answer to the question.

2. The large language model mathematical reasoning method based on repetition quality optimization according to claim 1 is characterized by: The step 1 specifically includes: selecting a mathematical problem q from the data set and constructing a prompt for the problem , use LLM to generate n paraphrases , the generated i-th retelling can be expressed as: .

3. The large language model mathematical reasoning method based on repetition quality optimization according to claim 2 is characterized by: The evaluation indicators in step 2 are: referring to the evaluation method of the text summarization task, four general indicators are set: coherence, consistency, fluency and relevance, and matching and logic indicators are added for mathematical problems; The prompt modes are: not using the indicator, using standard prompts, standard prompts + evaluation standards, standard prompts + evaluation standards + evaluation steps, where the standard prompts include the current task objectives, constraints, the original mathematical problem, the restatement to be evaluated, and the output template; The evaluation step is automatically generated by GPT-4; The four prompting methods are applied to the six evaluation indicators respectively, and their effects on the accuracy of the data set are observed to determine the best prompting method for each indicator. The prompting methods corresponding to each evaluation indicator can be expressed as follows: 。 4. The large language model mathematical reasoning method based on repetition quality optimization according to claim 3 is characterized by: The step three specifically includes: Combine the six indicators and their corresponding prompts in step 2, and use LLM to score each retelling with multiple indicators, with a score range of 1-5. LLM scores the retelling A single score under the Coh index can be expressed as ; Use the probability mean of the model output token as the single indicator score of LLM for the current retelling, and the language model output score is The probability of , then repeat The final score of indicator Coh can be expressed as: ; For LLMs such as GPT-4 that do not provide token output probabilities, multiple scoring and averaging are used to simulate and repeat Taking the score of indicator Coh as an example, LLM is used to score K times to obtain the score set ,in and , represents the output score of the model for the kth time, and the number of times the output score is t in the score set S is , you can use To simulate the probability that the LLM output score is t ,repeat The final score of indicator Coh can be expressed as: 。 5. The large language model mathematical reasoning method based on repetition quality optimization according to claim 1 is characterized by: The step 4 specifically includes: Use LLM to compare all paraphrases in pairs, using a circular comparison method, that is, each paraphrase needs to be compared with other alternative paraphrases once, so n paraphrases will form a total of A comparison group, repeat and retelling The comparison can be expressed as ,in Specific prompts to indicate pairwise comparisons; When comparing the comparison groups, they will be compared 5 times in sequence, and then the order of the two will be exchanged and compared 5 times. For each comparison, LLM will choose the repetition with better overall performance, which will receive 2 points. If the two repetitions are evenly matched, each will receive 1 point and the score will be recorded. and The scores obtained after comparison are and , After a round of effective pairwise comparison, a clear partial order relationship should be formed between the repetitions, that is, the following constraints are met, and the superiority relationship between the repetitions can form a directed acyclic Hasse graph; ; If the above constraints are not met between the repetitions, the comparison should be considered to be self-contradictory. The contradictory parts should be re-compared, and the superiority relationship between the repetitions should be converted into a directed graph. The parts that do not meet the above constraints will form a loop in the graph. Use topological sorting to remove all points with in-degree 0 and out-degree 0. The remaining parts that cannot be removed are all the repetitions that need to be re-compared.

6. The large language model mathematical reasoning method based on repetition quality optimization according to claim 1 is characterized by: The step five specifically includes: The decision module is an n-choose-one decision classification model. It evaluates and makes decisions based on the output of the multi-index scoring module and the results of the pairwise comparison module, and selects one of the n retellings as the best retelling. The training process is as follows: 5.1 Sample selection: Use LLM to generate n paraphrases for each sample in the training set , respectively, combined with the original question, using the Zero-shot CoT+SC method to respond T times, generate T answers, and record the number of correct answers as ,but Corresponding to , Definition paraphrase It is an optimal restatement if and only if it satisfies the following conditions: ; Select the best retelling samples from the training set as training samples for the decision module; 5.2 Obtain input features and labels: Perform steps 1 to 4 on the above-screened training samples in sequence, and obtain the scoring results from the multi-index scoring module , get the integral results from the pairwise comparison module , taking the above two as the input features of the model; taking the index of the best repetition as the label, it can be expressed as: , used to train the decision module; 5.3 Model selection: The decision module of the scheme uses the XGBoost algorithm to implement the classifier. Scoring results and The integral results are used as input features, and one of the n retellings is selected as the best retelling; 5.4 Optimize input features: The difference between the multi-index scores between repetitions and the difference between the scores of the pairwise comparisons are used as the input features of the model. and As input features, the feature dimension is effectively reduced to .

7. The large language model mathematical reasoning method based on repetition quality optimization according to claim 1 is characterized by: The step six specifically includes: Step 3: Scoring of the multi-index scoring module After feature optimization, it can be transformed into , Step 4: Integral of pairwise comparison modules After feature optimization, it can also be transformed into , input the decision module trained in step 5, and get the prediction with the best repetition .

8. The large language model mathematical reasoning method based on repetition quality optimization according to claim 1 is characterized by: The step seven specifically includes: Use the best selected paraphrase Combined with the original question q as a hint, the zero-sample thinking chain combined with self-consistency check is input to LLM to get the answer to the question. Indicate specific prompts and get: 。

Citation Information

Patent Citations

  • Replication sentence generation optimization method for intelligent inquiry system

    CN112397201A

  • Alignment evaluation method for Chinese large language model

    CN117633225A

  • Method and system for solving illusion problem of large legal language model

    CN117744802A

  • Computer implemented methods for the automated analysis or use of data, including use of a large language model

    WO2023161630A1

Cited By

  • Port knowledge abstract generation method based on large model

    CN119808932A

  • Drug interaction relationship prediction method based on LLMs and ICL

    CN120089234A

  • Multi-stage content quality evaluation method and system based on large language model

    CN120448618A

  • Quality evaluation method of thinking chain data, electronic equipment and storage medium

    CN120562572A