CN-122021889-A - Irrelevant condition neglect prompt generation method and relevant device for mathematical problem
Abstract
The invention belongs to the field of artificial intelligence, and discloses a method and a related device for generating irrelevant condition neglect prompts of mathematical problems, wherein the method comprises the steps of acquiring question sentences and all condition sentences of the mathematical problems; obtaining the similarity of questions of each condition sentence, obtaining the average similarity of each condition sentence and the rest condition sentences, obtaining each potential irrelevant condition sentence according to the similarity of questions and the condition similarity of each condition sentence, obtaining the irrelevant discrimination result of each potential irrelevant condition sentence according to the mathematical problem and each potential irrelevant condition sentence through a large language model, and generating the irrelevant condition neglect prompt of the mathematical problem according to the irrelevant discrimination result of each potential irrelevant condition sentence. The invention can solve the problems that in the prior art, when the mathematical problem is automatically solved by a large language model, irrelevant conditions in the mathematical problem are difficult to effectively identify, and the irrelevant conditions are introduced into a calculation process, so that solving errors are caused.
Inventors
- SHEN CHAO
- WU ZHENYU
- LIN CHENHAO
- ZHANG LI
Assignees
- 西安交通大学
Dates
- Publication Date
- 20260512
- Application Date
- 20260119
Claims (10)
- 1. A method for generating an irrelevant condition neglect hint for a mathematical problem, comprising: Acquiring a question sentence and each condition sentence of a mathematical problem; Obtaining the similarity between each conditional sentence and question sentence to obtain the question similarity of each conditional sentence, obtaining the average similarity between each conditional sentence and the rest conditional sentences to obtain the condition similarity of each conditional sentence, and obtaining each potential irrelevant conditional sentence according to the question similarity and the condition similarity of each conditional sentence; According to the mathematical problem and each potential irrelevant condition sentence, obtaining an irrelevant discrimination result of each potential irrelevant condition sentence through a large language model, and generating an irrelevant condition neglect prompt of the mathematical problem according to the irrelevant discrimination result of each potential irrelevant condition sentence.
- 2. The method for generating an irrelevant condition neglect hint for mathematical problems according to claim 1, wherein the obtaining the similarity between each conditional sentence and question sentence to obtain the question similarity of each conditional sentence, and the obtaining the average similarity between each conditional sentence and the rest of conditional sentences to obtain the conditional similarity of each conditional sentence comprises: coding the question sentence and each conditional sentence to obtain a vector coding representation of the question sentence and a vector coding representation of each conditional sentence; acquiring the question similarity of each condition sentence through the following steps: Wherein, the Is the first Question similarity of individual conditional sentences, Is that And (3) with Is used for the cosine similarity of the (c), Is the first The vector encoded representation of the individual conditional sentences, For a vector encoded representation of a question sentence, Is that Is provided with a die for the mold, Is that Is provided with a die for the mold, Is that Is a transpose of (2); obtaining the condition similarity of each condition sentence through the following steps: Wherein, the Is the first The conditional similarity of the individual conditional sentences, For the number of conditional sentences the number of the conditional sentences, Is that And (3) with Is used for the cosine similarity of the (c), Is the first The vector encoded representation of the individual conditional sentences, Is that Is a mold of (a).
- 3. The method of claim 2, wherein the conditional sentence comprises at most one numerical value, and wherein the encoding the question sentence with each conditional sentence comprises encoding the question sentence with each conditional sentence via a pre-trained language model SimCSE.
- 4. The method for generating an irrelevant condition neglect hint for a mathematical problem according to claim 1, wherein the obtaining each potential irrelevant condition sentence according to the question similarity and the condition similarity of each condition sentence comprises: When the question similarity of the conditional sentence is smaller than a preset question similarity threshold value or the condition similarity of the conditional sentence is smaller than a preset condition similarity threshold value, the conditional sentence is a potential irrelevant conditional sentence.
- 5. The method for generating an irrelevant condition neglect hint for a mathematical problem according to claim 1, wherein the generating an irrelevant condition neglect hint for a mathematical problem according to the mathematical problem and each potential irrelevant condition sentence by obtaining an irrelevant discrimination result of each potential irrelevant condition sentence through a large language model, and according to the irrelevant discrimination result of each potential irrelevant condition sentence comprises: Replacing mathematical problem placeholders in a preset judging and prompting template with mathematical problems, replacing potential irrelevant condition sentence placeholders in the preset judging and prompting template with potential irrelevant condition sentences, replacing question placeholders in the preset judging and prompting template with question sentences of the mathematical problems, generating judging and prompting of the potential irrelevant condition sentences, and inputting the judging and prompting prompt into a large language model to obtain judging results of the potential irrelevant condition sentences; And splicing the discrimination results of each potential irrelevant condition sentence to obtain a spliced discrimination result, and replacing the spliced discrimination result placeholders in the preset irrelevant condition neglect prompting template by adopting the spliced discrimination result to generate an irrelevant condition neglect prompting of the mathematical problem.
- 6. The method for generating an irrelevant condition neglect cue for a mathematical problem according to claim 1, further comprising: Acquiring a plurality of demonstration mathematical problems and ignoring prompts of irrelevant conditions of each demonstration mathematical problem; neglecting prompts according to the demonstration mathematical problems and irrelevant conditions of the demonstration mathematical problems, generating an reasoning process of the demonstration mathematical problems through a large language model, and combining the demonstration mathematical problems with the reasoning process of the demonstration mathematical problems to obtain a plurality of demonstration samples; And splicing the plurality of demonstration samples to obtain a spliced demonstration sample, and adopting irrelevant condition neglect prompts of mathematical problems and irrelevant condition neglect prompts of splicing results of the spliced demonstration samples to update the mathematical problems.
- 7. The method of generating an irrelevant condition ignoring cue for a mathematical problem according to claim 6, wherein said obtaining a number of demo mathematical problems comprises: acquiring a plurality of candidate mathematical problems, and taking the candidate mathematical problems with high preset number before confusion degree scoring in the plurality of candidate mathematical problems as demonstration mathematical problems; The confusion degree score of the candidate mathematical problem is obtained by obtaining a question sentence and each conditional sentence of the candidate mathematical problem, calculating the reciprocal of the average value of the similarity between each conditional sentence and the question sentence of the candidate mathematical problem, and obtaining the confusion degree score of the candidate mathematical problem.
- 8. An irrelevant condition ignoring cue generating system for a mathematical problem, comprising: the acquisition module is used for acquiring question sentences and all condition sentences of the mathematical problem; The recognition module is used for obtaining the similarity between each condition sentence and the question sentence to obtain the question similarity of each condition sentence, obtaining the average similarity between each condition sentence and the rest condition sentences to obtain the condition similarity of each condition sentence, and obtaining each potential irrelevant condition sentence according to the question similarity and the condition similarity of each condition sentence; the generation module is used for obtaining the irrelevant discrimination result of each potential irrelevant condition sentence through a large language model according to the mathematical problem and each potential irrelevant condition sentence, and generating an irrelevant condition neglect prompt of the mathematical problem according to the irrelevant discrimination result 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 the processor, when executing the computer program, implements the steps of the method for generating a prompt for irrelevant condition omission of mathematical problems as defined in any one of claims 1 to 7.
- 10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method for generating a prompt for irrelevant condition omission of mathematical problems as defined in any one of claims 1 to 7.
Description
Irrelevant condition neglect prompt generation method and relevant device for mathematical problem Technical Field The invention belongs to the field of artificial intelligence, and relates to a method and a related device for generating irrelevant condition neglect prompts of mathematical problems. Background The automatic solving of mathematical problems is a process of analyzing and solving by using a computer program according to the content of topics described by natural language. This task is challenging because it requires mathematical understanding capabilities and multi-step logical reasoning capabilities. With the advent of large language models, researchers have proposed thought chain prompting methods that guide the large language models to generate intermediate solving steps by constructing multiple demonstration examples so as to gradually obtain answers to mathematical questions. Research has shown that the mental chain prompting method may be interfered by irrelevant conditions in mathematical questions, resulting in a large language model to generate wrong answers. Therefore, in order to avoid the interference of the large language model by irrelevant conditions in the mathematical problem, part of researchers realize the neglect of irrelevant conditions by adding a guide statement of 'please ignore irrelevant conditions in the problem description' before the mathematical problem to be solved. However, experiments have shown that large language models in this manner cannot effectively ignore irrelevant conditions because the conditions in the guide statement are not explicitly stated as irrelevant conditions, and cannot be guided to correctly ignore irrelevant conditions in mathematical problems. Therefore, how to help a large language model identify and ignore irrelevant conditions in a mathematical problem is a technical problem to accurately and automatically solve the mathematical problem containing the irrelevant conditions. Disclosure of Invention The invention aims to overcome the defects of the prior art and provide a method and a related device for generating irrelevant condition neglect prompts of mathematical problems. In order to achieve the purpose, the invention is realized by adopting the following technical scheme: The invention provides a generation method of irrelevant condition neglect prompts of mathematical problems, which comprises the steps of obtaining question sentences and all condition sentences of the mathematical problems, obtaining the question similarity of all condition sentences by obtaining the similarity between all condition sentences and the question sentences, obtaining the condition similarity of all condition sentences by obtaining the average similarity of all condition sentences and the rest condition sentences, obtaining all potential irrelevant condition sentences according to the question similarity and the condition similarity of all condition sentences, obtaining the irrelevant discrimination results of all potential irrelevant condition sentences through a large language model according to the mathematical problems and all potential irrelevant condition sentences, and generating the irrelevant condition neglect prompts of the mathematical problems according to the irrelevant discrimination results of all potential irrelevant condition sentences. Optionally, the obtaining the similarity between each conditional sentence and question sentence to obtain the question similarity of each conditional sentence, and obtaining the average similarity between each conditional sentence and the rest conditional sentences to obtain the condition similarity of each conditional sentence includes encoding the question sentence and each conditional sentence to obtain a vector encoding representation of the question sentence and a vector encoding representation of each conditional sentence: Wherein, the Is the firstQuestion similarity of individual conditional sentences,Is thatAnd (3) withIs used for the cosine similarity of the (c),Is the firstThe vector encoded representation of the individual conditional sentences,For a vector encoded representation of a question sentence,Is thatIs provided with a die for the mold,Is thatIs provided with a die for the mold,Is thatIs a transpose of (a). Obtaining the condition similarity of each condition sentence through the following steps: Wherein, the Is the firstThe conditional similarity of the individual conditional sentences,For the number of conditional sentences the number of the conditional sentences,Is thatAnd (3) withIs used for the cosine similarity of the (c),Is the firstThe vector encoded representation of the individual conditional sentences,Is thatIs a mold of (a). Optionally, the condition sentence comprises at most one numerical value, and the encoding the question sentence with each condition sentence comprises encoding the question sentence with each condition sentence through a pre-training language mod