Mathematical problem irrelevant condition ignoring prompt generation method and related device
By identifying and generating irrelevant condition ignoring prompts, this technology helps large language models ignore irrelevant conditions during the solution of mathematical problems, solving the problem of difficulty in identifying irrelevant conditions in existing technologies and improving the accuracy and robustness of the solution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XI AN JIAOTONG UNIV
- Filing Date
- 2026-01-19
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, large language models struggle to effectively identify and ignore irrelevant conditions when faced with mathematical problems, leading to solution errors.
By obtaining the similarity between the question and condition sentences of mathematical problems, potential irrelevant condition sentences are identified, and a large language model is used to determine irrelevance, generating irrelevant condition ignoring prompts to guide the model to ignore irrelevant conditions during the solution process.
It improves the accuracy of large language models in solving mathematical problems, reduces computational resource consumption, and enhances the robustness and accuracy of the model when dealing with complex problems.
Smart Images

Figure CN122021889A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and relates to a method and related apparatus for generating irrelevant condition ignoring prompts for mathematical problems. Background Technology
[0002] Automated problem-solving in mathematics involves using computer programs to analyze and solve problems based on natural language descriptions. This task is challenging because it requires mathematical comprehension and multi-step logical reasoning. With the emergence of large language models, researchers have proposed a thought chain prompting method. By constructing multiple demonstration examples, this method guides the large language model to generate intermediate solution steps, gradually leading to the answer to the mathematical problem.
[0003] Research indicates that thought chain prompting methods can be interfered with by irrelevant conditions in mathematical problems, leading large language models to generate incorrect answers. Therefore, to avoid interference from irrelevant conditions in mathematical problems, some researchers have added a guiding statement before the mathematical problem to be solved: "Please ignore irrelevant conditions in the problem description," thus achieving the ignoring of irrelevant conditions.
[0004] However, experiments show that large language models cannot effectively ignore irrelevant conditions in this way. This is because the guiding statements do not explicitly specify which conditions are irrelevant, thus failing to guide the large language model to correctly ignore irrelevant conditions in mathematical problems. Therefore, how to help large language models identify and ignore irrelevant conditions in mathematical problems is a pressing technical problem that needs to be solved to achieve accurate and automatic solutions to mathematical problems containing irrelevant conditions. Summary of the Invention
[0005] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and related apparatus for generating irrelevant condition ignoring prompts for mathematical problems.
[0006] To achieve the above objectives, the present invention employs the following technical solution: In a first aspect, the present invention provides a method for generating irrelevant condition ignoring prompts for a mathematical problem, comprising: obtaining the question sentence and each condition sentence of the mathematical problem; obtaining the similarity between each condition sentence and the question sentence to obtain the question similarity of each condition sentence, and obtaining the average similarity between each condition sentence and the remaining condition sentences to obtain the condition similarity of each condition sentence; obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence; obtaining the irrelevance discrimination result of each potentially irrelevant condition sentence through a large language model based on the mathematical problem and each potentially irrelevant condition sentence; and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevance discrimination results of each potentially irrelevant condition sentence.
[0007] Optionally, obtaining the question similarity between each conditional sentence and the question sentence to obtain the question similarity of each conditional sentence, and obtaining the average similarity between each conditional sentence and the remaining conditional sentences to obtain the conditional similarity of each conditional sentence, includes: encoding the question sentence and each conditional sentence to obtain the vector encoding representation of the question sentence and the vector encoding representation of each conditional sentence; obtaining the question similarity of each conditional sentence using the following formula:
[0008] in, For the first The similarity of the questions in the conditional sentences. for and cosine similarity, For the first Vector encoding representation of each conditional clause The vector encoding representation of the question sentence. for The model, for The model, for The transpose of .
[0009] The conditional similarity of each conditional clause is obtained using the following formula:
[0010] in, For the first Conditional similarity of each conditional clause. The number of conditional clauses, for and cosine similarity, For the first Vector encoding representation of each conditional clause for The model.
[0011] Optionally, the conditional sentences may contain at most one numerical value; encoding the question sentence and each conditional sentence includes: encoding the question sentence and each conditional sentence using a pre-trained language model SimCSE.
[0012] Optionally, obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence includes: when the question similarity of the condition sentence is less than a preset question similarity threshold, or when the condition similarity of the condition sentence is less than a preset condition similarity threshold, the condition sentence is a potentially irrelevant condition sentence.
[0013] Optionally, the step of obtaining the irrelevance discrimination results of each potential irrelevant conditional sentence through a large language model based on the mathematical problem and each potential irrelevant conditional sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant discrimination results of each potential irrelevant conditional sentence, includes: replacing the mathematical problem placeholder in the preset discrimination prompt template with the mathematical problem, replacing the potential irrelevant conditional sentence placeholder in the preset discrimination prompt template with the potential irrelevant conditional sentence, and replacing the question sentence placeholder in the preset discrimination prompt template with the question sentence of the mathematical problem, generating discrimination prompts for potential irrelevant conditional sentences and inputting them into the large language model to obtain the discrimination results for potential irrelevant conditional sentences; concatenating the discrimination results of each potential irrelevant conditional sentence to obtain a concatenated discrimination result, replacing the concatenated discrimination result placeholder in the preset irrelevant condition ignoring prompt template with the concatenated discrimination result, and generating irrelevant condition ignoring prompts for the mathematical problem.
[0014] Optionally, it also includes: obtaining several demonstration math problems and irrelevant condition ignoring hints for each demonstration math problem; generating the reasoning process for each demonstration math problem through a large language model based on each demonstration math problem and its irrelevant condition ignoring hints, and combining the reasoning processes of each demonstration math problem to obtain several demonstration examples; splicing the several demonstration examples to obtain spliced demonstration examples, and updating the irrelevant condition ignoring hints for the math problems using the splicing result of the math problems' irrelevant condition ignoring hints and the spliced demonstration examples.
[0015] Optionally, obtaining several demonstration math problems includes: obtaining several candidate math problems, and selecting the candidate math problems with the highest number of perplexity scores as demonstration math problems; wherein, the perplexity scores of the candidate math problems are obtained by: obtaining the question sentence and each condition sentence of the candidate math problem, calculating the reciprocal of the average similarity between each condition sentence and the question sentence of the candidate math problem, and obtaining the perplexity score of the candidate math problem.
[0016] In a second aspect, the present invention provides a system for generating irrelevant condition ignoring prompts for mathematical problems, comprising: an acquisition module for acquiring the question sentence and each condition sentence of the mathematical problem; an identification module for acquiring the similarity between each condition sentence and the question sentence to obtain the question similarity of each condition sentence, and acquiring the average similarity between each condition sentence and the remaining condition sentences to obtain the condition similarity of each condition sentence, and obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence; and a generation module for obtaining the irrelevance discrimination result of each potentially irrelevant condition sentence through a large language model based on the mathematical problem and each potentially irrelevant condition sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevance discrimination result of each potentially irrelevant condition sentence.
[0017] In a third aspect, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-mentioned method for generating irrelevant condition ignoring prompts for mathematical problems.
[0018] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method for generating irrelevant condition ignoring prompts for the above-mentioned mathematical problem.
[0019] Compared with the prior art, the present invention has the following beneficial effects: This invention discloses a method for generating irrelevant condition ignoring hints for mathematical problems. First, the mathematical problem is broken down into a question and several condition sentences. Then, potential candidate irrelevant conditions are identified based on the question similarity and condition similarity of the condition sentences. Next, a large language model is used to obtain the irrelevant discrimination results for each potential irrelevant condition sentence, effectively reducing computational resource consumption. Finally, based on the irrelevant discrimination results of each potential irrelevant condition sentence, irrelevant condition ignoring hints for the mathematical problem are generated. This effectively guides the large language model to ignore irrelevant condition sentences in the mathematical problem-solving process, further improving the accuracy of the large language model in solving mathematical problems. Attached Figure Description
[0020] Figure 1 This is a flowchart of a method for generating irrelevant condition hints for mathematical problems according to an embodiment of the present invention.
[0021] Figure 2 The irrelevant condition ignoring hints are used to generate a system structure block diagram for the mathematical problem in this embodiment of the invention. Detailed Implementation
[0022] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] The present invention will now be described in further detail with reference to the accompanying drawings: See Figure 1 In one embodiment of the present invention, a method for generating irrelevant condition ignoring prompts for mathematical problems is provided. By constructing accurate irrelevant condition ignoring prompts, the method helps a large language model to identify and ignore irrelevant conditions in the problem during the solution process of mathematical problems, thereby improving the solution accuracy. This method can solve the problem in the prior art that when automatically solving mathematical problems through a large language model, it is difficult to effectively identify irrelevant conditions in mathematical problems, and irrelevant conditions are introduced into the calculation process, which leads to solution errors.
[0025] Specifically, the method for generating irrelevant condition ignoring hints for mathematical problems in this invention includes the following steps: S1: Obtain the question sentence and condition sentences of the mathematical problem.
[0026] S2: Obtain the similarity between each conditional sentence and the question sentence to get the question similarity of each conditional sentence, and obtain the average similarity between each conditional sentence and the remaining conditional sentences to get the conditional similarity of each conditional sentence, and obtain each potential irrelevant conditional sentence based on the question similarity and conditional similarity of each conditional sentence.
[0027] S3: Based on the mathematical problem and each potential irrelevant conditional sentence, obtain the irrelevant discrimination results of each potential irrelevant conditional sentence through the large language model, and generate irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant discrimination results of each potential irrelevant conditional sentence.
[0028] This invention discloses a method for generating irrelevant condition ignoring hints for mathematical problems. First, the mathematical problem is broken down into a question and several condition sentences. Then, potential candidate irrelevant conditions are identified based on the question similarity and condition similarity of the condition sentences. Next, a large language model is used to obtain the irrelevant discrimination results for each potential irrelevant condition sentence, effectively reducing computational resource consumption. Finally, based on the irrelevant discrimination results of each potential irrelevant condition sentence, irrelevant condition ignoring hints for the mathematical problem are generated. This effectively guides the large language model to ignore irrelevant condition sentences in the mathematical problem-solving process, further improving the accuracy of the large language model in solving mathematical problems.
[0029] In one possible implementation, obtaining the similarity between each conditional sentence and the question sentence to obtain the question similarity of each conditional sentence, and obtaining the average similarity between each conditional sentence and the remaining conditional sentences to obtain the conditional similarity of each conditional sentence, includes: encoding the question sentence and each conditional sentence to obtain the vector encoded representation of the question sentence and the vector encoded representation of each conditional sentence.
[0030] The similarity of the questions for each conditional clause is obtained using the following formula:
[0031] in, For the first The similarity of the questions in the conditional sentences. for and cosine similarity, For the first Vector encoding representation of each conditional clause The vector encoding representation of the question sentence. for The model, for The model, for The transpose of .
[0032] The conditional similarity of each conditional clause is obtained using the following formula:
[0033] in, For the first Conditional similarity of each conditional clause. The number of conditional clauses, for and cosine similarity, For the first Vector encoding representation of each conditional clause for The model.
[0034] Explanatory, for a given mathematical problem First, divide it into Each conditional statement and one question statement. For example, each conditional statement may contain at most one numerical value.
[0035] For explanatory purposes, cosine similarity is used as the basis for similarity calculation when obtaining the similarity between each conditional sentence and the question sentence, as well as the average similarity between each conditional sentence and the remaining conditional sentences. Cosine similarity measures the difference in direction of vectors rather than absolute distance, which can effectively reduce the bias caused by the difference in vector length, thus focusing more on semantic similarity assessment. Secondly, cosine similarity is computationally efficient and can maintain low computational cost when processing a large number of text fragments.
[0036] In one possible implementation, the pre-trained language model SimCSE is used to encode the conditional sentence and the question sentence, resulting in a vector encoding representation of the conditional sentence. and the vector encoding representation of the question. In this embodiment, the vector encoding representation has a dimension of 1,024.
[0037] The interpretable, pre-trained language model SimCSE (Simple Contrastive Learning of Sentence Embeddings) is an efficient sentence embedding method based on contrastive learning. This method does not require complex negative sample mining or data augmentation strategies. It can train a high-performing semantic encoder with only unsupervised text data. It performs well in semantic similarity calculation tasks and is suitable for application scenarios that require measuring semantic associations between texts.
[0038] In one possible implementation, obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence includes: when the question similarity of the condition sentence is less than a preset question similarity threshold, or when the condition similarity of the condition sentence is less than a preset condition similarity threshold, the condition sentence is a potentially irrelevant condition sentence.
[0039] For example, in this embodiment, the preset question similarity threshold is set to 0.5. That is, if the question similarity of the current conditional sentence is less than 0.5, the conditional sentence is considered a potentially irrelevant conditional sentence. In this embodiment, the preset condition similarity threshold is set to 0.5. That is, if the condition similarity of the current conditional sentence is less than 0.5, the conditional sentence is considered a potentially irrelevant conditional sentence.
[0040] Explanatoryly, by analyzing the question similarity and condition similarity of each conditional sentence, potential irrelevant conditional sentences can be accurately identified. A conditional sentence with low semantic relevance to the core of the question (low question similarity) or lack of synergy with other conditional sentences in the question (low condition similarity) is highly likely to be unnecessary distracting information in solving the problem. This quantitative and automated filtering allows for the rapid focusing of a few potential irrelevant conditional sentences from numerous conditions, minimizing the workload of submitting them to a large language model for final judgment. This avoids the high computational cost and potential confusion caused by having a large language model directly examine all conditional sentences, achieving an optimal balance between computational resource consumption and judgment accuracy, and laying a reliable foundation for subsequently generating high-quality irrelevant condition ignoring prompts.
[0041] In one possible implementation, the step of obtaining the irrelevance discrimination results of each potential irrelevant conditional sentence through a large language model based on the mathematical problem and each potential irrelevant conditional sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant discrimination results of each potential irrelevant conditional sentence, includes: replacing the mathematical problem placeholder in a preset discrimination prompt template with the mathematical problem, replacing the potential irrelevant conditional sentence placeholder in the preset discrimination prompt template with the potential irrelevant conditional sentence, and replacing the question sentence placeholder in the preset discrimination prompt template with the question sentence of the mathematical problem, generating discrimination prompts for potential irrelevant conditional sentences and inputting them into the large language model to obtain discrimination results for potential irrelevant conditional sentences; concatenating the discrimination results of each potential irrelevant conditional sentence to obtain a concatenated discrimination result, replacing the concatenated discrimination result placeholder in the preset irrelevant condition ignoring prompt template with the concatenated discrimination result, and generating irrelevant condition ignoring prompts for the mathematical problem.
[0042] Explanatory, based on the obtained potential irrelevant conditional clauses We use a large language model to examine whether each potential irrelevant conditional clause is indeed irrelevant to the solution process of the mathematical problem.
[0043] Specifically, mathematical problems, potentially irrelevant conditions, and interrogative sentences are used as input to the large language model, and discriminative suggestions are constructed using a pre-defined discriminative suggestion template. For example, the following discriminative suggestion template is used: .condition Whether or not Is it related to the solution process? For mathematical problems, For the first k A potentially irrelevant conditional clause, This is a question. Then, through discriminative prompts, the large language model is guided to generate the first... k The results of identifying potentially irrelevant conditional clauses A total of [number] generators are capable of generating [something]. Result of the judgment: .
[0044] Furthermore, by Result of judgment The concatenation results are then used to replace the placeholder in the preset irrelevant condition ignoring prompt template, thereby generating an irrelevant condition ignoring prompt for the math problem. For example, the preset irrelevant condition ignoring prompt template is: "Judgment as follows: P, based on the above judgment result, ignore the irrelevant conditions in the math problem to answer the math question," where P is the concatenation result placeholder.
[0045] Furthermore, irrelevant condition ignoring hints in mathematical problems can be combined with existing hinting engineering techniques to improve the ability of large language models to identify and ignore irrelevant conditions in mathematical problems. For example, irrelevant condition ignoring hints can be combined with thought chain hinting methods to construct hints such as: . Let's think about this step by step: (wherein,) Ignore the prompt for irrelevant conditions. This is a mathematical problem. It can help large language models ignore irrelevant conditions during the step-by-step solution of mathematical problems, thus obtaining more accurate results.
[0046] In one possible implementation, the method for generating irrelevant condition ignoring hints for mathematical problems further includes: obtaining several demonstration mathematical problems and irrelevant condition ignoring hints for each demonstration mathematical problem; generating the reasoning process for each demonstration mathematical problem using a large language model based on each demonstration mathematical problem and its irrelevant condition ignoring hints, and combining the reasoning processes of each demonstration mathematical problem to obtain several demonstration examples; splicing the several demonstration examples to obtain spliced demonstration examples, and updating the irrelevant condition ignoring hints for the mathematical problems using the splicing result of the irrelevant condition ignoring hints for the mathematical problems and the spliced demonstration examples.
[0047] For example, for each demonstration math problem, the reasoning process is generated using a thought chain prompting method through a large language model, such as constructing the demonstration math problem as a demonstration example prompt: Let's think about this step by step: (wherein,) To demonstrate a mathematical problem, a demonstration example is input into a large language model, which then outputs the reasoning process for the mathematical problem. Then, the demonstration mathematical problems are combined with the reasoning processes of each demonstration mathematical problem to obtain demonstration examples: ( , ).
[0048] For example, this embodiment provides eight demonstration examples.
[0049] Explanatoryly, this paper presents a few-shot hint method using several demonstration examples to help large language models better solve difficult problems. Specifically, by adopting the few-shot hint method, the demonstration examples provide concrete and referable templates for large language models, intuitively demonstrating how to identify and ignore irrelevant conditions and how to effectively integrate ignored hints into the problem-solving logic. By combining the spliced demonstration examples with irrelevant condition ignoring hints for the current mathematical problem, the contextual learning ability of large language models can be fully utilized, enabling them to quickly adapt to and follow the problem-solving paradigm of ignoring irrelevant conditions. This effectively reduces the probability of large language models making errors due to irrelevant information interference when dealing with novel or complex problems, significantly enhances the understanding and reasoning ability of large language models when solving complex or difficult mathematical problems, and improves the robustness and accuracy of solutions.
[0050] In one possible implementation, obtaining several demonstration math problems includes: obtaining several candidate math problems, and selecting the candidate math problems with the highest number of perplexity scores as demonstration math problems; wherein, the perplexity scores of the candidate math problems are obtained by: obtaining the question sentence and each condition sentence of the candidate math problem, calculating the reciprocal of the average similarity between each condition sentence and the question sentence of the candidate math problem, and obtaining the perplexity score of the candidate math problem.
[0051] For explanatory purposes, to enhance the demonstrative effect of the demonstration examples, candidate math problems with high perplexity scores were used to obtain the demonstration math problems. The perplexity score of a candidate math problem is the reciprocal of the average similarity between the conditional statements and the question statement; that is, the lower the average similarity between the conditional statements and the question statement in a math problem, the higher its perplexity.
[0052] For example, the perplexity score of a candidate mathematical problem is obtained by the following formula:
[0053] in, For candidate mathematical problems Confusion level rating For candidate mathematical problems The number of conditional clauses, for and cosine similarity, For candidate mathematical problems The Vector encoding representation of each conditional clause For candidate mathematical problems The vector encoding representation of the question.
[0054] In one possible implementation, taking a specific mathematical problem as an example, the specific process of the method for generating irrelevant condition ignoring prompts for mathematical problems according to the present invention is illustrated.
[0055] Step 1: For the math problem: "Steve is 5 feet 6 inches tall. He has grown 6 inches. Mary is 5 feet tall. How tall is Steve now (in inches)?", first break it down into several conditional statements: {"Steve is 5 feet 6 inches tall.". "He has grown 6 inches.". "Mary is 5 feet tall."}, and one question: "How tall is Steve now (in inches)?".
[0056] Step 2: Use the pre-trained language model SimCSE to encode the conditional sentences and the question sentences to obtain the vector encoded representations of the conditional sentences and the question sentences.
[0057] Step 3: Obtain the cosine similarity between each conditional sentence and the question sentence as the question similarity of each conditional sentence, and obtain the average cosine similarity between each conditional sentence and the remaining conditional sentences as the conditional similarity of each conditional sentence. Based on the preset question similarity threshold (0.5) and the preset conditional similarity threshold (0.5), identify potentially irrelevant conditional sentences. Specifically, calculations reveal that the conditional sentences "He grew 6 inches taller" and "Mary's height is 5 feet" are potentially irrelevant conditional sentences.
[0058] Step 4: Based on the mathematical problem and each potentially irrelevant conditional sentence, obtain the irrelevance determination result for each potentially irrelevant conditional sentence using the large language model. Specifically, for the conditional sentence "He grew 6 inches taller," the large language model determines that it is related to the solution process of the mathematical problem; for the conditional sentence "Mary's height is 5 feet," the large language model determines that it is irrelevant to the solution process of the mathematical problem.
[0059] Step 5: Based on the irrelevance judgment results of each potential irrelevant conditional statement, generate an irrelevant condition ignoring hint for the math problem: "Judgment is as follows: The conditional statement 'He grew 6 inches taller.' is related to the solution process of the math problem, while the conditional statement 'Mary's height is 5 feet.' is irrelevant to the solution process of the math problem. Combining the above judgment results, ignore the irrelevant conditions in the math problem to answer the math problem."
[0060] Step 6: Combine the irrelevant condition ignoring hint with the thinking chain hint method to construct the reasoning hint: "The judgment is as follows: the conditional statement 'He grew 6 inches taller.' is related to the solution process of the math problem, while the conditional statement 'Mary's height is 5 feet.' is irrelevant to the solution process of the math problem. Combining the above judgment results, ignore the irrelevant conditions in the math problem to answer the math problem: Steve's height is 5 feet 6 inches. He grew 6 inches taller. Mary's height is 5 feet. How tall is Steve now (in inches)? Let's think about it step by step:", and then input the reasoning hint into the large language model. The large language model will generate the reasoning process: "Steve's height is 5 feet 6 inches, which is equal to 66 inches. Then he grew 6 inches taller, so his new height is 72 inches." Finally, extract the final answer to the math problem: "72".
[0061] The following are embodiments of the apparatus of the present invention, which can be used to execute embodiments of the method of the present invention. For details not disclosed in the apparatus embodiments, please refer to the embodiments of the method of the present invention.
[0062] See Figure 2 In another embodiment of the present invention, an irrelevant condition ignoring prompt generation system for mathematical problems is provided, which can be used to implement the above-mentioned irrelevant condition ignoring prompt generation method for mathematical problems. Specifically, the irrelevant condition ignoring prompt generation system for mathematical problems includes an acquisition module, an identification module, and a generation module.
[0063] The module consists of three parts: an acquisition module for acquiring the question sentence and condition sentences of a mathematical problem; an identification module for acquiring the similarity between each condition sentence and the question sentence to obtain the question similarity of each condition sentence, and acquiring the average similarity between each condition sentence and the remaining condition sentences to obtain the condition similarity of each condition sentence, as well as obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence; and a generation module for obtaining the irrelevance discrimination results of each potentially irrelevant condition sentence through a large language model based on the mathematical problem and each potentially irrelevant condition sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant discrimination results of each potentially irrelevant condition sentence.
[0064] In one possible implementation, obtaining the question similarity between each conditional sentence and the question sentence to obtain the question similarity of each conditional sentence, and obtaining the average similarity between each conditional sentence and the remaining conditional sentences to obtain the conditional similarity of each conditional sentence, includes: encoding the question sentence and each conditional sentence to obtain the vector encoded representation of the question sentence and the vector encoded representation of each conditional sentence; obtaining the question similarity of each conditional sentence using the following formula:
[0065] in, For the first The similarity of the questions in the conditional sentences. for and cosine similarity, For the first Vector encoding representation of each conditional clause The vector encoding representation of the question sentence. for The model, for The model, for The transpose of .
[0066] The conditional similarity of each conditional clause is obtained using the following formula:
[0067] in, For the first Conditional similarity of each conditional clause. The number of conditional clauses, for and cosine similarity, For the first Vector encoding representation of each conditional clause for The model.
[0068] In one possible implementation, the conditional sentences contain at most one numerical value; the encoding of the question sentence and each conditional sentence includes: encoding the question sentence and each conditional sentence using a pre-trained language model SimCSE.
[0069] In one possible implementation, obtaining each potentially irrelevant condition sentence based on the question similarity and condition similarity of each condition sentence includes: when the question similarity of the condition sentence is less than a preset question similarity threshold, or when the condition similarity of the condition sentence is less than a preset condition similarity threshold, the condition sentence is a potentially irrelevant condition sentence.
[0070] In one possible implementation, the step of obtaining the irrelevance discrimination results of each potential irrelevant conditional sentence through a large language model based on the mathematical problem and each potential irrelevant conditional sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant discrimination results of each potential irrelevant conditional sentence, includes: replacing the mathematical problem placeholder in a preset discrimination prompt template with the mathematical problem, replacing the potential irrelevant conditional sentence placeholder in the preset discrimination prompt template with the potential irrelevant conditional sentence, and replacing the question sentence placeholder in the preset discrimination prompt template with the question sentence of the mathematical problem, generating discrimination prompts for potential irrelevant conditional sentences and inputting them into the large language model to obtain discrimination results for potential irrelevant conditional sentences; concatenating the discrimination results of each potential irrelevant conditional sentence to obtain a concatenated discrimination result, replacing the concatenated discrimination result placeholder in the preset irrelevant condition ignoring prompt template with the concatenated discrimination result, and generating irrelevant condition ignoring prompts for the mathematical problem.
[0071] In one possible implementation, the irrelevant condition ignoring hint generation system for the mathematical problem further includes an update module, configured to: acquire several demonstration mathematical problems and irrelevant condition ignoring hints for each demonstration mathematical problem; generate the reasoning process for each demonstration mathematical problem using a large language model based on each demonstration mathematical problem and its irrelevant condition ignoring hints, and combine the reasoning processes of each demonstration mathematical problem to obtain several demonstration examples; splice the several demonstration examples to obtain spliced demonstration examples, and update the irrelevant condition ignoring hints for the mathematical problem using the splicing result of the irrelevant condition ignoring hints for the mathematical problem and the spliced demonstration examples.
[0072] In one possible implementation, obtaining several demonstration math problems includes: obtaining several candidate math problems, and selecting the candidate math problems with the highest number of perplexity scores as demonstration math problems; wherein, the perplexity scores of the candidate math problems are obtained by: obtaining the question sentence and each condition sentence of the candidate math problem, calculating the reciprocal of the average similarity between each condition sentence and the question sentence of the candidate math problem, and obtaining the perplexity score of the candidate math problem.
[0073] All relevant content of each step involved in the aforementioned embodiments of the method for generating irrelevant condition hints for mathematical problems can be referenced to the functional description of the corresponding functional module of the mathematical problem irrelevant condition hint generation system in the embodiments of the present invention, and will not be repeated here.
[0074] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the invention can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0075] In another embodiment of the present invention, a computer device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions in the computer storage medium to achieve a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used for the operation of a method for generating irrelevant condition hints in mathematical problems.
[0076] In another embodiment of the present invention, a storage medium is provided, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, the storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the irrelevant condition ignoring prompt generation method for mathematical problems in the above embodiments.
[0077] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0078] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0079] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0080] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method for generating irrelevant condition hints for mathematical problems, characterized in that, include: Obtain the question and condition sentences of a mathematical problem; The similarity between each conditional sentence and the question sentence is obtained to obtain the question similarity of each conditional sentence, and the average similarity between each conditional sentence and the remaining conditional sentences is obtained to obtain the conditional similarity of each conditional sentence. Finally, each potentially irrelevant conditional sentence is obtained based on the question similarity and conditional similarity of each conditional sentence. Based on the mathematical problem and each potential irrelevant conditional sentence, the irrelevance discrimination results of each potential irrelevant conditional sentence are obtained through a large language model. Based on the irrelevance discrimination results of each potential irrelevant conditional sentence, irrelevant condition ignoring prompts for the mathematical problem are generated.
2. The method for generating irrelevant condition hints for mathematical problems according to claim 1, characterized in that, The process of obtaining the question similarity between each conditional sentence and the question sentence to obtain the question similarity of each conditional sentence, and obtaining the conditional similarity between each conditional sentence and the remaining conditional sentences to obtain the conditional similarity of each conditional sentence, includes: The question sentence and each condition sentence are encoded to obtain the vector encoded representation of the question sentence and the vector encoded representation of each condition sentence; The similarity of the questions for each conditional clause is obtained using the following formula: in, For the first The similarity of the questions in the conditional sentences. for and cosine similarity, For the first Vector encoding representation of each conditional clause The vector encoding representation of the question sentence. for The model, for The model, for Transpose of; The conditional similarity of each conditional clause is obtained using the following formula: in, For the first Conditional similarity of each conditional clause. The number of conditional clauses, for and cosine similarity, For the first Vector encoding representation of each conditional clause for The model.
3. The method for generating irrelevant condition hints for mathematical problems according to claim 2, characterized in that, The conditional sentence contains at most one numerical value; the encoding of the question sentence and each conditional sentence includes: encoding the question sentence and each conditional sentence using a pre-trained language model SimCSE.
4. The method for generating irrelevant condition hints for mathematical problems according to claim 1, characterized in that, The process of obtaining each potentially irrelevant conditional sentence based on the question similarity and condition similarity of each conditional sentence includes: When the question similarity of a conditional sentence is less than a preset question similarity threshold, or when the conditional similarity of a conditional sentence is less than a preset conditional similarity threshold, the conditional sentence is considered a potentially irrelevant conditional sentence.
5. The method for generating irrelevant condition hints for mathematical problems according to claim 1, characterized in that, The process of obtaining irrelevance judgment results for each potential irrelevant conditional sentence through a large language model based on the mathematical problem and each potential irrelevant conditional sentence, and generating irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant judgment results of each potential irrelevant conditional sentence, includes: The algorithm replaces the placeholders for mathematical questions in the preset discrimination prompt template with mathematical questions, replaces the placeholders for potentially irrelevant conditional sentences in the preset discrimination prompt template with potentially irrelevant conditional sentences, and replaces the placeholders for question sentences in the preset discrimination prompt template with questions about mathematical questions. The algorithm generates discrimination prompts for potentially irrelevant conditional sentences and inputs them into the large language model to obtain the discrimination results for potentially irrelevant conditional sentences. The results of the judgment of each potential irrelevant condition sentence are concatenated to obtain the concatenated judgment result. The concatenated judgment result is used to replace the placeholder of the concatenated judgment result in the preset irrelevant condition ignore prompt template to generate irrelevant condition ignore prompt for mathematical problems.
6. The method for generating irrelevant condition hints for mathematical problems according to claim 1, characterized in that, Also includes: Obtain several demonstration math problems and ignore irrelevant conditions for each demonstration math problem; Based on each demonstration mathematical problem and the irrelevant conditions of each demonstration mathematical problem, the reasoning process of each demonstration mathematical problem is generated through a large language model. The reasoning processes of each demonstration mathematical problem are then combined to obtain several demonstration examples. Several demonstration examples are spliced together to obtain a spliced demonstration example, and the irrelevant condition ignoring hints of the mathematical problem are updated using the spliced result of the mathematical problem's irrelevant condition ignoring hints and the spliced demonstration example.
7. The method for generating irrelevant condition hints for mathematical problems according to claim 6, characterized in that, The acquisition of several demonstrative mathematical problems includes: Obtain a number of candidate mathematical problems, and select the candidate mathematical problems with the highest number of pre-set perplexity scores from among the candidate mathematical problems as demonstration mathematical problems; The perplexity score of the candidate math problem is obtained as follows: the question sentence and each condition sentence of the candidate math problem are obtained, and the reciprocal of the average similarity between each condition sentence and the question sentence of the candidate math problem is calculated to obtain the perplexity score of the candidate math problem.
8. A system for generating prompts that ignore irrelevant conditions in mathematical problems, characterized in that, include: The acquisition module is used to retrieve the question sentence and condition sentences of a mathematical problem; The identification module is used to obtain the similarity between each conditional sentence and the question sentence to obtain the question similarity of each conditional sentence, and to obtain the average similarity between each conditional sentence and the remaining conditional sentences to obtain the conditional similarity of each conditional sentence, and to obtain each potentially irrelevant conditional sentence based on the question similarity and conditional similarity of each conditional sentence. The generation module is used to obtain the irrelevance judgment results of each potential irrelevant condition sentence through a large language model based on the mathematical problem and each potential irrelevant condition sentence, and to generate irrelevant condition ignoring prompts for the mathematical problem based on the irrelevant judgment results of each potential irrelevant condition sentence.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the irrelevant condition ignoring prompt generation method for mathematical problems as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the irrelevant condition ignoring prompt generation method for mathematical problems as described in any one of claims 1 to 7.