Inference task execution method, electronic equipment, readable storage medium and program product

Through the method of bilingual model collaboration, the first language model is used to generate initial ideas and optimize the second language model, combined with real-time scoring and correction mechanism, the problem of logical errors in complex inference tasks is solved, and efficient and low-cost high-quality inference data generation is achieved.

CN119886360AActive Publication Date: 2025-04-25LANGCHAO ELECTRONIC INFORMATION IND CO LTD

Patent Information

Application Number
CN202510352937.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-25
Publication Date
2025-04-25
Estimated Expiration
2045-03-25

AI Technical Summary

Technical Problem

When performing complex inference tasks in the prior art, the generated inference chain may have logical errors and cannot meet the user's accuracy needs.

Method used

Using the method of bilingual model collaboration, firstly use the first language model to generate preliminary ideas for task execution, and then correct and optimize the initial ideas through the second language model to ensure the accuracy of task execution ideas. Then, each step of the task is gradually generated using the first language model, and after each step is generated, the second language model is used to score and correct it in real time, and the generation process is dynamically adjusted.

Benefits of technology

Through the dual-model collaborative reflection method, the authenticity and logical coherence of the reasoning chain are improved, the high quality of inference data is ensured, and the execution accuracy and efficiency of complex inference tasks are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886360A_ABST
    Figure CN119886360A_ABST
Patent Text Reader

Abstract

The invention discloses a reasoning task execution method, electronic equipment, a readable storage medium and a program product, and relates to the technical field of artificial intelligence. The method comprises the following steps: inputting a to-be-processed task and a cue word into a task processing model comprising a first language model and a second language model; according to the cue word, utilizing a first language model to generate an initial task execution thought corresponding to the to-be-processed task, utilizing a second language model and the to-be-processed task to analyze the initial task execution thought, and utilizing the first language model to determine a task execution thought according to the initial task execution thought and a thought analysis result; and based on a single-step analysis result output by the second language model, utilizing the first language model to gradually generate each task execution step according to the task execution thought. According to the method, the problems of high cost and low accuracy of a complex reasoning task in related technologies can be solved, high-quality reasoning data can be efficiently generated at low cost, and the execution accuracy of the complex reasoning task is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a reasoning task execution method, electronic equipment, computer-readable storage medium, and computer program product. Background Art

[0002] NLP (Natural Language Processing) can help computers understand and process human language, enabling computers to read and understand natural language. With the rapid development of artificial intelligence technology, the accuracy requirements of language models when performing complex reasoning tasks are becoming increasingly higher.

[0003] Related technologies improve the accuracy of language models in performing complex reasoning tasks by generating multi-step reasoning paths or combining search algorithms. However, the reasoning chain generated by this method may have logical errors and cannot meet the user's accuracy requirements. Summary of the invention

[0004] The present invention provides a method for executing a reasoning task, an electronic device, a computer-readable storage medium, and a computer program product, which can generate high-quality reasoning data efficiently and at low cost, and effectively improve the execution accuracy and efficiency of complex reasoning tasks.

[0005] In order to solve the above technical problems, the present invention provides the following technical solutions: On one hand, the present invention provides a method for executing an inference task, comprising: The task to be processed and the prompt word are input into a pre-trained task processing model; the task processing model includes a first language model and a second language model; according to the prompt word, the first language model is used to generate an initial task execution idea corresponding to the task to be processed, the second language model and the task to be processed are used to analyze the initial task execution idea, and the first language model is used to determine the task execution idea according to the initial task execution idea and the idea analysis result; according to the prompt word, based on the single-step analysis result output by the second language model, the first language model is used to gradually generate each task execution step according to the task execution idea, and the single-step analysis result is obtained by analyzing a single initial task execution step output by the first language model.

[0006] Another aspect of the present invention provides a method for executing an inference task, comprising: Input the reasoning task training sample set and the prompt words into a pre-built task processing model, the task processing model includes a first language model and a second language model that have been pre-trained, and the labels of each reasoning task data sample in the reasoning task training sample set at least include questions, task execution ideas, idea adjustment process, task execution steps, step reflection process and task execution results; according to the prompt words, use the first language model to generate initial idea prediction data corresponding to the problem sample of the current reasoning task data sample, and use the second language model and the problem sample to analyze the initial idea prediction data; and use the first language model to determine the idea prediction data according to the initial idea prediction data and the idea analysis prediction result; according to the prompt words, analyze a single initial task execution prediction step output by the first language model based on the second language model, and obtain the single step analysis prediction result, use the first language model according to the idea prediction data to gradually generate task execution prediction steps, and use the problem sample, initial idea prediction data, idea analysis prediction result, each initial task execution prediction step, single step analysis prediction result and each task execution prediction step as prediction data; based on the labels of each reasoning task data sample and its corresponding prediction data, continuously train the task processing model until the preset model training stop condition is met.

[0007] The present invention also provides an electronic device, including a memory and a processor, wherein the processor is used to implement the steps of any one of the reasoning task execution methods in the above method embodiments when executing a computer program stored in the memory.

[0008] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the reasoning task execution method in the above method embodiment are implemented.

[0009] Finally, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of any of the above-mentioned reasoning task execution methods when executed by a processor.

[0010] The advantage of the technical solution provided by the present invention is that the first language model is used to generate the preliminary idea of ​​task execution. Considering that it may introduce errors, the second language model is used to correct and optimize it to improve the accuracy of the task execution idea, which is conducive to improving the accuracy of task execution. After determining the task execution idea, the first language model is used to gradually generate each step of the task execution. Whenever a task execution step is generated, the second language model is used to score and correct the task execution step generated by the first language model in real time, so as to dynamically adjust the generation process of each task execution step to ensure its accuracy and logical coherence. Based on this dual-model collaborative reflection method, the second language model is used to score and correct the reasoning path generated by the first language model in real time, and the errors are adjusted in time to ensure the authenticity of the reasoning chain, which provides fine-grained quality assurance for the generated data. In addition, since the task processing model is a direct reasoning ability given by generating long-thinking training data, it does not need to be called multiple times, which can not only improve the efficiency of task execution, but also reduce a lot of computing costs, thereby achieving efficient and low-cost generation of high-quality reasoning data, and effectively improving the execution accuracy and efficiency of complex reasoning tasks.

[0011] In addition, the present invention also provides corresponding electronic devices, computer-readable storage media and computer program products for implementing the reasoning task execution method, which further makes the method more practical, and the electronic devices, computer-readable storage media and computer program products have corresponding advantages. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. 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 creative work.

[0013] Figure 1 A schematic diagram of a hardware composition framework applicable to the reasoning task execution method provided by the present invention; Figure 2 A flowchart of a method for executing a reasoning task provided by the present invention; Figure 3 A schematic diagram of a process of dual-model collaboration to generate an execution task idea in an exemplary example provided by the present invention; Figure 4 A flowchart of dual-model collaboration generation task execution steps in an exemplary example provided by the present invention; Figure 5 A flowchart of another method for executing a reasoning task provided by the present invention; Figure 6 A schematic diagram of a process for generating a training sample set for a reasoning task in an exemplary example provided by the present invention; Figure 7 A structural framework diagram of an exemplary implementation of the inference task execution device provided by the present invention; Figure 8 A structural framework diagram of another exemplary embodiment of the inference task execution device provided by the present invention; Fig. 9 This is a structural diagram of an exemplary embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION

[0014] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Among them, the terms "first", "second", "third", etc. in the specification and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations of the two are intended to cover non-exclusive inclusions. The term "exemplary" means "used as an example, embodiment or illustrative". Any embodiment described here as "exemplary" is not necessarily interpreted as being superior or better than other embodiments.

[0015] With the development of natural language processing technology, the understanding and generation capabilities of language models have been greatly improved, such as in general conversations, text generation and other language tasks. However, for complex reasoning tasks such as mathematical problem solving, code generation, and logical reasoning, these tasks require multi-step reasoning, logical deduction, and the identification and correction of error patterns.

[0016] Related technologies improve the accuracy of reasoning trajectories and mathematical logic reasoning capabilities by generating multi-step reasoning paths or combining search algorithms, such as using thought chains, self-consistency, thought trees, and reinforcement learning training. However, these methods lack the systematic generation of high-quality reasoning data, resulting in model training relying on limited and low-quality labeled data, which limits generalization capabilities, and also has problems of high computational cost and low efficiency. Taking the thought chain method as an example, this method provides examples of step-by-step reasoning to guide the language model to generate multi-step answers, which significantly improves the interpretability and answer accuracy of the language model. However, it requires a large number of high-quality reasoning chain examples, which usually require manual annotation and are costly. For models with a small number of parameters, this method is difficult to spontaneously generate correct reasoning chains, and the accuracy is low. In addition, the reasoning chain generated by this method may have logical errors or redundant steps, and the generation of multi-step reasoning paths requires multiple calls to the model, which has high computational costs. It can be seen that related technologies cannot achieve efficient, low-cost, and high-accuracy execution of complex reasoning tasks.

[0017] In view of this, the present invention uses the first language model to generate a preliminary idea for task execution, and uses the second language model to correct and optimize the idea. After determining a task execution idea with high accuracy, the first language model is used to gradually generate each execution step for executing the task to be processed. Whenever a task execution step is generated, the second language model is used to perform real-time scoring and correction on the task execution step generated by the first language model, and dynamically adjust the generation process of each task execution step to ensure its accuracy and logical coherence. Based on this dual-model collaborative reflection method, complex reasoning tasks can be executed efficiently, accurately and at low cost.

[0018] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the reasoning task execution method depends, the specific application environment architecture or specific hardware architecture is described here. Figure 1 Some possible application scenarios involved in the technical solution of the present invention are introduced by way of example, which may include the following contents: like Figure 1 As shown, the hardware composition framework may include a first electronic device 11 and a second electronic device 12, and the first electronic device 11 and the second electronic device 12 are connected via a network 13. The first electronic device 11 is deployed with a processor for the inference task execution method described in the embodiment of the present invention, and the second electronic device 12 may be a user terminal deployed to provide a human-computer interaction interface, such as a smart phone, a tablet, and a personal computer. Among them, the human-computer interaction interface may be the interface of the corresponding application software, or it may be an interface opened in a browser by specifying a URL (Uniform Resource Locator). One of the application scenarios of the embodiment of the present invention can be achieved through the interaction between the second electronic device 12 and the user. In this application scenario, the user can input the task to be processed through the human-computer interaction interface, and the human-computer interaction interface sends the task to be processed to the first electronic device 11 through the network 13. The first electronic device 11 can be, for example, a server. The first electronic device 11 processes the task to be processed through all or part of the steps in the execution of the reasoning task recorded in the method embodiment of the present invention, and combines the initial task execution ideas, idea analysis results, task execution ideas, each initial task execution step, single step analysis results and each task execution step into a task processing result, and sends it to the second electronic device 12 through the network 13. The task processing result can be displayed at the corresponding position of the human-computer interaction interface, and can also be displayed to the user in other ways such as voice or text.

[0019] It should be noted that the above application scenarios are only shown to facilitate understanding of the ideas and principles of the present invention, and the embodiments of the present invention are not limited in this respect. On the contrary, the embodiments of the present invention can be applied to any applicable scenario. After introducing the technical solution of the present invention, various non-limiting embodiments of the present invention are described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0020] First see Figure 2 , Figure 2 A flowchart of a method for executing an inference task provided in this embodiment may include the following contents: S201: Inputting the task to be processed and the prompt word into a pre-trained task processing model.

[0021] In this step, the tasks to be processed are tasks that require the execution of complex reasoning tasks, including but not limited to mathematical and logical reasoning related question-and-answer tasks, code generation tasks, and legal reasoning tasks. Mathematical and logical reasoning related question-and-answer tasks such as math problem solving tasks or word problem solving tasks. The tasks to be processed can be input in any form, such as text, tables, graphics, videos, and voices, and at least include questions, which are, for example, math problems described in visual form and / or language form. The questions in this embodiment support any form of expression, such as text form, image form, or voice form, and the stem and the picture may appear at the same time. The prompt word is a prompt word that tells the task processing model how to perform the task, and can be flexibly set according to the actual application scenario.

[0022] Among them, the task processing model is a pre-trained language model. The network model structure of the task processing model of the present invention includes at least a first language model and a second language model. On this basis, when the task to be processed is allowed to be input in multiple ways, a corresponding encoding module can be set in the input layer. If voice input is supported, a network model for voice-to-text or voice-to-image conversion needs to be added to the input layer of the task processing model. If visual or text information input is supported, an image encoder and a text encoder need to be added to the input layer of the task processing model. The first language model and the second language model are language models that use different network model structures and can process natural language tasks. The present invention does not limit the model types of the first language model and the second language model. The scale or parameter amount of the first language model and the second language model may be the same or different, which does not affect the implementation of the present invention. In order to reduce the resources required for the task processing model, the performance of the first language model and the second language model of the present invention are different. The first language model can select a language model with a parameter amount of less than 7b, such as LLAMA2-7B (name of the artificial intelligence network model) or GPT-3.5 (name of the artificial intelligence network model), and the second language model can select a language model with a parameter amount of more than 7b, for example, GPT-4 (name of the artificial intelligence network model) or Claude-3 (name of the artificial intelligence network model). The task processing model is built using the first language model and the second language model, and the task processing model is trained using any model training method using a training sample data set that matches the task to be processed, and the trained task processing model is used to execute the task to be processed. Of course, if the accuracy requirements of the task to be processed are high and the available computing resources and storage resources are relatively abundant, the task processing model may also include a larger-scale third language model or more language models, and the third language model is used to reflect and correct the output of the second language model, and the quality and diversity of the reasoning chain are further improved through the collaboration of three models or more models.

[0023] S202: Generate an initial task execution idea corresponding to the task to be processed using the first language model according to the prompt word, analyze the initial task execution idea using the second language model and the task to be processed, and determine the task execution idea based on the initial task execution idea and the idea analysis result using the first language model.

[0024] Among them, the initial task execution idea refers to the first language model's idea of ​​how to execute the task to be processed. Since the task execution idea output by the first language model may introduce errors, in order to avoid description, it can be defined as the initial task execution idea. In order to determine whether there are errors in the initial task execution ideas, based on the reflection mechanism in the human thinking process, the second language model can be used to analyze the initial task execution ideas, thereby simulating the human thinking process from intuitive judgment to in-depth deliberation. For the convenience of description, the analysis result of the initial task execution ideas by the second language model is defined as the idea analysis result. The idea analysis result at least includes relevant information on whether the initial task execution ideas are wrong and how to improve the initial task execution ideas. The task execution ideas used to assist in generating the execution task steps are finally determined by the initial task execution ideas and the idea analysis results. If the idea analysis results determine that the initial task execution ideas are highly accurate and there is no need for improvement, the initial task execution ideas are the task execution ideas. If the idea analysis results determine that the initial task execution ideas are not accurate and / or there are areas that need improvement, the initial task execution ideas are adjusted according to the idea analysis results, that is, the first language model regenerates the initial task execution ideas based on the idea analysis results and the tasks to be processed. The adjusted initial task execution ideas or the newly generated initial task execution ideas are the final task execution ideas, thereby improving the logical rigor and practicality of the generated data.

[0025] S203: According to the prompt word, the single-step analysis result obtained by analyzing the single initial task execution step output by the first language model based on the second language model is analyzed, and each task execution step is gradually generated according to the task execution idea using the first language model.

[0026] In this embodiment, the first language model is used to obtain the task execution idea according to the above steps, and each task execution step for executing the task to be processed is generated step by step. For the convenience of description, it is defined as the initial task execution step. By gradually generating the reasoning chain, the logical rigor and integrity of such complex reasoning tasks can be ensured. In order to improve the accuracy of task execution, whenever the first language model generates an initial task execution step, the second language model is used to analyze the initial task execution step. The analysis result is defined as a single-step analysis result, which at least includes relevant information on whether the initial task execution step is wrong and how to improve the initial task execution step. The task execution steps finally outputted are determined based on the initial task execution step outputted by the first language model and the single-step analysis result. If the single-step analysis result determines that the initial task execution step has high accuracy and there is no need for improvement, the initial task execution step is the final task execution step. If the single-step analysis result determines that the initial task execution step has low accuracy and / or there is a need for improvement, the initial task execution step is adjusted according to the single-step analysis result, that is, the first language model regenerates the initial task execution step based on the single-step analysis result and the task to be processed. The adjusted initial task execution idea, that is, the newly generated initial task execution step, is the final task execution step of the current step, simulating the human thinking mode of step-by-step deduction when solving complex problems, thereby improving the logical rigor and practicality of the generated data. According to actual needs, the task processing model can output the final answer obtained by synthesizing the execution steps of each task as the final task processing result of the task to be processed. Of course, the initial task execution ideas, idea analysis results, task execution ideas, each initial task execution step, single step analysis results, each task execution step and the final answer can also be composed into a reasoning data chain, and the reasoning data chain is output as the final task processing result of the task to be processed. Of course, the data content contained in the reasoning data chain can be flexibly adjusted according to needs, which does not affect the implementation of the present invention.

[0027] In the technical solution provided in this embodiment, the first language model is used to generate the preliminary idea of ​​task execution. Considering that it may introduce errors, the second language model is used to correct and optimize it to improve the accuracy of the task execution idea, which is conducive to improving the accuracy of task execution. After determining the task execution idea, the first language model is used to gradually generate each step of the task execution. Whenever a task execution step is generated, the second language model is used to score and correct the task execution step generated by the first language model in real time, so as to dynamically adjust the generation process of each task execution step to ensure its accuracy and logical coherence. Based on this dual-model collaborative reflection method, the second language model is used to score and correct the reasoning path generated by the first language model in real time, and the errors are adjusted in time to ensure the authenticity of the reasoning chain, which provides fine-grained quality assurance for the generated data. In addition, since the task processing model is a direct reasoning ability given by generating long-thinking training data, it does not need to be called multiple times, which can not only improve the efficiency of task execution, but also reduce a lot of computing costs, thereby achieving efficient and low-cost generation of high-quality reasoning data, and effectively improving the execution accuracy and efficiency of complex reasoning tasks.

[0028] In the above embodiment, there is no limitation on how to analyze the initial task execution idea. Based on the above embodiment, the present invention further provides an exemplary implementation method of analyzing the initial task execution idea by using the second language model and the task to be processed and generating an idea analysis result, which may include the following contents: The second language model and idea analysis prompts are used to score the initial task execution ideas, and the task execution idea modification suggestions are output based on the tasks to be processed and the initial task execution ideas.

[0029] In this embodiment, whether the initial task execution idea is wrong can be reflected in a quantitative form, that is, by scoring. The prompt words in the above embodiment include at least a prompt word for idea analysis, and the prompt word for idea analysis is used to prompt the second language model to score the initial task execution idea and give suggestions for idea modification. The first language model and the second language model have different parameter quantities, and the parameter quantity of the second language model is greater than that of the first language model. Correspondingly, the model performance of the second language model is better than that of the first language model, and the output of the first language model can be effectively corrected by the second language model. Using a weak model to perform tasks and using a strong model to assist can also reduce the resources required for the task processing model and improve the efficiency of task execution.

[0030] When the second language model outputs modification opinions on task execution ideas, if the score of the initial task execution ideas is lower than the preset idea passing score threshold, the first language model regenerates the task execution ideas according to the modification opinions on the task execution ideas; if the score of the initial task execution ideas is not lower than the preset idea passing score threshold, the initial task execution ideas are used as the task execution ideas.

[0031] The threshold of the preset passing score of the idea can be flexibly set according to actual needs, such as 60 points. For example, the task to be processed is a math problem-solving task. Accordingly, the task to be processed at least includes a question, the first language model is a weak model, the second language model is a strong model, and Figure 3For example, the idea prompt words of the weak model are "Analyze the above problems and generate solution ideas. Do not answer the problem, and do not generate specific solution steps." The weak model generates preliminary solution ideas according to the input problem and the prompt words. For example, the math problem is "Solve the equation x^2-5x+6=0", and the preliminary solution idea generated by the weak model is "Use factorization to decompose the equation into two linear factors, and then solve the roots." The idea prompt words of the strong model are "Score the above solution ideas based on accuracy, ranging from 0 to 10 points. The more accurate the idea, the higher the score, and 6 points is the passing score. Output the scoring results in the format of 'How many points are the above analysis scored' and give modification suggestions. Do not generate modified solution ideas. Do not answer the problem, and do not generate specific solution steps." Based on the idea prompt, the strong model scores and reflects on the preliminary solution ideas generated by the weak model, and outputs the task execution idea modification suggestions: "The above analysis score is 8 points. Modification suggestion: The factorization method is applicable to this equation, but it is necessary to clearly point out that the equation can be decomposed into (x-2)(x-3)=0, and explain how to get the root through factorization". If the task execution idea modification suggestion is: "The above analysis score is 5 points. Modification suggestion: The factorization method is applicable to this equation, but it is necessary to clearly point out that the equation can be decomposed into (x-2)(x-3)=0, and explain how to get the root through factorization", the weak model will regenerate the solution idea according to the task execution idea modification suggestions of the strong model. When generating the task execution idea again, the prompt words of the weak model can be "Generate a new solution idea based on the modification suggestions on the solution idea in the above text. Do not answer the problem and do not generate specific problem-solving steps." Correspondingly, the revised solution generated by the weak model can be: "Use the factorization method to decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0, and then solve (x-2)=0 and (x-3)=0 to get the root". Finally, the "problem-solution idea-idea reflection-idea correction" can be saved as structured data. For example, for the above math problem, the saved data format is: Problem: Solve the equation x^2-5x+6=0. Solution idea: Use the factorization method to decompose the equation into two linear factors, and then solve the root. Idea reflection: The above analysis score is 6 points. Modification suggestion: The factorization method is applicable to this equation, but it is necessary to clearly point out that the equation can be decomposed into (x-2)(x-3)=0, and explain how to get the root by factorization. Correction of thinking: Use factorization to decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0, and then find the root by solving (x-2)=0 and (x-3)=0.

[0032] As can be seen from the above, this embodiment generates preliminary ideas through the weak model, and then corrects and optimizes them through the strong model through scoring and modification opinions, guiding the weak model to gradually correct errors, and finally generating logically rigorous and clearly structured reasoning data. By simulating the human thinking process from intuitive judgment to deep deliberation through the collaboration of strong and weak dual models, it can not only generate high-quality task execution idea data, effectively improve the logical rigor and practicality of the generated data, but also provide rich reflective learning samples for subsequent model training, significantly enhancing the model's reasoning ability and dynamic correction ability.

[0033] In the above embodiment, there is no limitation on how to analyze the initial task execution steps. Based on the above embodiment, the present invention also provides an exemplary implementation method of step reflection and correction, which may include the following contents: According to the pending tasks and task execution ideas, the first language model is used to generate the current task execution steps for executing the pending tasks according to the generated content, and output them according to the generated format; the pending tasks, task execution ideas and current task execution steps are input into the second language model as step reflection data; the second language model is used to score the current task execution steps according to the step reflection prompt words, and give step modification suggestions; if the score of the current task execution step is lower than the preset step passing score threshold, the first language model regenerates the current task execution steps based on the step modification opinions and the step regeneration prompt words.

[0034] In this embodiment, the current task execution step may refer to any task execution step, and the prompt words include at least generated content, generated format, and step reflection prompt words. The generated content is used to limit the content output by the first language model and the second language model to prevent irrelevant content or redundant information from being output. The generated format is used to limit the format of the content output by the first language model and the second language model. In order to better process data, the first language model will not generate multiple task execution steps at one time or directly output the final answer, but will be generated step by step in strict accordance with the requirements of the prompt words. The step reflection prompt words are used to prompt the second language model to score the last task execution step output by the first language model and give step modification suggestions. For example, in a code generation task, the second language model may point out that the variable naming of a certain step is not standardized or the logic is not clear. The first language model can regenerate a better code snippet based on the feedback.

[0035] In this embodiment, the process of executing the task to be processed using the task processing model can be: based on the task to be processed and the task execution idea, using the first language model to generate the first task execution step for executing the task to be processed according to the generated content, and output it according to the generated format; the task to be processed, the task execution idea and the first task execution step are input into the second language model as step reflection data; using the second language model to score the first task execution step according to the step reflection prompt, and give step modification suggestions; if the score of the first task execution step is lower than the preset step passing score threshold, the first language model regenerates the first task execution step according to the step modification suggestions; if the score of the first task execution step is greater than or equal to the preset step passing score threshold, the first language model does not need to regenerate the first task execution step according to the step modification suggestions. Then, according to the pending task and the task execution idea, the first language model is used to generate the second task execution step for executing the pending task according to the generated content, and output it according to the generated format; the pending task, the task execution idea, the newly generated first task execution step or the first task execution step and the second task execution step are input into the second language model as step reflection data; the second language model is used to score the second task execution step according to the step reflection prompt, and give step modification suggestions; if the score of the second task execution step is lower than the preset step passing score threshold, the first language model regenerates the second task execution step according to the step modification suggestion; if the score of the second task execution step is greater than or equal to the preset step passing score threshold, the first language model does not need to regenerate the second task execution step according to the step modification suggestion. Repeat the above process until the number of steps currently generated is equal to the total number of steps generated or the currently generated step is the last step, then all the currently generated task execution steps are output as the task processing result.

[0036] In order to make those skilled in the art more clearly understand the implementation process of the above embodiment, the task to be processed is also a mathematical problem-solving task. Accordingly, the task to be processed at least includes a question, the first language model is a weak model, and the second language model is a strong model, such as Figure 4As shown, according to the input problem and task execution ideas corresponding to the task to be processed, the weak model is called to generate the first step of the problem-solving step of the math problem-solving task according to the prompt "Based on the above solution ideas, generate the first step of the problem-solving step, and start generating with 'step 1'. It is required to generate only one step of the problem-solving step". For example, the math problem-solving task is "solve the equation x^2-5x+6=0", and the first problem-solving step generated by the weak model is "step 1, decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0". Combining the input problem, the task execution ideas and the existing step-level solution, that is, the first problem-solving step, according to the prompt "Do not score the solution ideas, score the last problem-solving step according to the solution ideas, the range is 0 to 10 points, the more accurate the steps, the higher the score, and 6 points is the passing line. Output the scoring results in the format of 'how many points are the problem-solving step score' and give modification suggestions. Do not generate new problem-solving steps", the strong model is called to score and reflect on the last problem-solving step. For example, a math problem-solving task is "solve the equation x^2-5x+6=0". If the first problem-solving step generated is "Step 1, decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0", if the strong model scores the step and outputs step modification suggestions: "The problem-solving step score is 9 points. Modification suggestions: The decomposition step is correct, but you can add an explanation on how to get (x-2)(x-3)=0 by factoring", then there is no need to regenerate. If the strong model scores the step and outputs the step modification suggestion: "The problem-solving step score is 5 points. Modification suggestion: the decomposition step is incomplete, and it is necessary to clearly explain how to obtain (x-2)(x-3)=0 through factorization", then according to the prompt "Regenerate the problem-solving step according to the modification suggestions for the problem-solving step above. Do not generate subsequent steps", call the weak model to regenerate the problem-solving step according to the step modification suggestions. The weak model regenerates the first problem-solving step as "Step 1, decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0. The specific method is to find two numbers whose product is 6 and whose sum is -5, and obtain -2 and -3". When the first problem-solving step is completed, according to the existing problem-solving steps, such as the first n-1 steps, follow the prompt "Based on the above solution ideas and the existing problem-solving steps (first n-1 steps), generate the next problem-solving step (nth step), and start generating with 'step n,'. If all the problem-solving steps already exist, the final answer is returned in the form of a box. Only one problem-solving step is required to be generated", and call the weak model to generate the next problem-solving step. For example, based on the first problem-solving step, the second problem-solving step generated by the weak model can be "Step 2, solve the equation (x-2)=0, and get x=2." If the problem-solving steps have been completed at this time, the weak model will generate the final answer and return it in the form of a box, for example, the output can be: "Final answer: \boxed{2}, \boxed{3}.".

[0037] As can be seen from the above, in the process of generating each step, this embodiment can ensure that only one clear task execution step is output in each step by limiting the generated content and format, avoiding the generation of redundant or irrelevant information, which not only improves the controllability of the generated data, but also ensures the logical coherence of the reasoning chain. Further, the generation process of each step of the problem-solving step can be dynamically adjusted through step-level reflection and correction, and its accuracy and logical coherence are ensured by simulating the self-examination and correction of each step of derivation when solving problems by humans, thereby generating high-quality reasoning chain data. The scoring and feedback of the second language model not only help the weak model to correct errors, but also provide fine-grained quality assurance for the generated data. In other words, this embodiment uses a weaker large model and a stronger model to collaboratively generate task execution ideas and task execution steps that include reflection and correction processes, which is more in line with the thinking process of humans when solving complex problems. This process controls the generation of step-level answers by cyclically calling the model and finally outputs the final answer to ensure the correctness and integrity of the reasoning process.

[0038] In order to further improve the efficiency of reasoning task execution, based on the above embodiment, the present invention further limits the total number of step generation in the prompt word, and gradually generates each task execution step under the limitation of the total number of step generation, which may include the following contents: If the number of current task execution steps is greater than the total number of steps generated, all currently generated task execution steps are output as task execution results; if the number of current task execution steps is less than or equal to the total number of steps generated, based on the pending task and the task execution idea, the first language model is used to generate the current task execution steps for executing the pending task according to the generated content in the prompt word, and the steps are output according to the generated format in the prompt word; the pending task, the task execution idea and the current task execution step are used as step reflection data and input into the second language model, and when the score of the current task execution step is less than the preset step passing score threshold, the current task execution step is regenerated using the first language model; if the current task execution step is the last step, all currently generated task execution steps are output as task execution results; if the current task execution step is not the last step, based on the pending task and the task execution idea, the first language model is used to generate the next task execution step of the current task execution step according to the generated content.

[0039] In this embodiment, the total number of steps generated is used to limit the maximum number of steps generated. If the number of steps executed in the current task reaches the total number of steps generated, the generation process will be forcibly terminated and the current result will be returned. For example, if the total number of steps generated is 10, and the number of steps executed in the current task is 10, the generation process will be forcibly terminated and the current result will be returned. The process of executing the pending task in combination with the total number of step generation in the prompt word can be as follows: according to the pending task and the task execution idea, the first language model is used to generate the first task execution step of the pending task according to the generated content, and output it according to the generated format; the pending task, the task execution idea and the first task execution step are used as step reflection data and input into the second language model; the second language model is used to score the first task execution step according to the step reflection prompt and give step modification suggestions; if the current number of task execution steps is not greater than the total number of step generation, according to the pending task and the task execution idea, the first language model is used to generate the second task execution step of the pending task according to the generated content, and output it according to the generated format; the pending task, the task execution idea, the newly generated or initial first task execution step and the second task execution step are used as step reflection data and input into the second language model; the second language model is used to score the second task execution step according to the step reflection prompt and give step modification suggestions; if the current number of task execution steps is equal to the total number of step generation, the newly generated first task execution step and the second task execution step are output as the task execution result.

[0040] As can be seen from the above, this embodiment can prevent the problem of infinite generation steps or redundant steps by dynamically controlling the number of generation steps, and avoid the missing steps or logical errors caused by insufficient generation capacity of the task processing model while ensuring generation efficiency. In addition, by dynamically adjusting the total number of generation steps, it can adapt to the complexity requirements of different tasks and has strong scalability.

[0041] In order to further improve the efficiency of reasoning task execution, based on the above embodiment, the present invention also limits the number of reflections in the prompt word, and gradually generates each task execution step under the limit of the number of reflections, which may include the following contents: If the number of current task execution steps generated by the first language model is less than the number of reflections + 1, the pending task, task execution ideas and current task execution steps are input into the second language model as step reflection data; the second language model is used to score the current task execution steps according to the step reflection prompt words, and step modification suggestions are given; if the score of the current task execution steps is lower than the preset step passing score threshold, the first language model regenerates the current task execution steps according to the step modification suggestions; if the number of current task execution steps generated by the first language model is equal to the number of reflections + 1, and the current task execution step is not the last step, then according to the pending task and task execution ideas, the first language model is used to generate the next task execution step of the current task execution step according to the generated content in the prompt words.

[0042] In this embodiment, by limiting the number of reflections, such as a maximum of 3 times, the task processing model can be effectively prevented from falling into an infinite loop of "reflection-modification" during the execution of the pending task. If the preset step passing score threshold cannot be reached after multiple corrections, the current step can be recorded and the next step can be generated to ensure the integrity of the overall reasoning chain. The process of executing the pending task in combination with the total number of step generation and the number of reflection times in the prompt word can be as follows: according to the pending task and the task execution idea, the first language model is used to generate the first task execution step of the pending task according to the generated content, and output it according to the generated format; the pending task, the task execution idea and the first task execution step are used as step reflection data and input into the second language model; the second language model is used to score the first task execution step according to the step reflection prompt and give step modification suggestions; the first language model is used to generate a new first task execution step again based on the step modification suggestions, and when the number of generation of the first task execution step is less than the number of reflection times + 1, the pending task, the task execution idea and the current task execution step are used as step reflection data and input into the second language model again; if the number of generation of the first task execution step is equal to the number of reflection times + 1, and the current task execution step is not the last step, according to the pending task and the task execution idea, the first language model is used to generate the next task execution step of the current task execution step according to the generated content in the prompt word. If the number of current task execution steps is not greater than the total number of generated steps, based on the pending task and the task execution ideas, use the first language model to generate the second task execution step for executing the pending task according to the generated content, and output it according to the generated format; use the pending task, the task execution ideas, the newly generated or initial first task execution step and the second task execution step as step reflection data, and input them into the second language model; use the second language model to score the second task execution step according to the step reflection prompts, and give step modification suggestions; if the number of current task execution steps is equal to the total number of generated steps, output the newly generated first task execution step and the second task execution step as the task execution result.

[0043] As can be seen from the above, this embodiment can avoid missing steps or logical errors caused by insufficient generation capacity of the task processing model by limiting the number of reflections while ensuring generation efficiency. In addition, by dynamically adjusting the number of generation reflections, it can adapt to different task complexity requirements and has strong scalability.

[0044] The present invention also provides another method for executing a reasoning task, such as Figure 5 As shown, it may include the following: S501: Inputting the reasoning task training sample set and prompt words into a pre-built task processing model.

[0045] In this embodiment, the task processing model may include a first language model and a second language model that have completed pre-training. Pre-training is a strategy for deep learning model training, which uses a large-scale data set to perform preliminary training on the model so that the first language model and the second language model learn a common feature representation. This process is similar to the basic learning stage of humans before learning new knowledge, accumulating experience through extensive reading and observation. Completing the pre-trained first language model and second language model means designing language model training tasks based on a large-scale corpus (including language training materials such as sentences and paragraphs), training a large-scale neural network algorithm structure to learn and implement, and the large-scale neural network algorithm structure and parameters finally obtained are pre-trained language models. Subsequent tasks can be based on the model to extract features or fine-tune tasks to achieve specific task purposes. The idea of ​​pre-training is to first train a task to obtain a set of model parameters, then use the set of model parameters to initialize the network model parameters, and then use the initialized network model to train other tasks to obtain models adapted to other tasks. By pre-training on a large-scale corpus, the neural language representation model can learn powerful language representation capabilities and can extract rich syntactic and semantic information from the text. The pre-trained language model can provide tokens and sentence-level features containing rich semantic information for use in downstream tasks, or fine-tune the downstream tasks directly on the pre-trained model to obtain downstream exclusive models quickly and conveniently. The neural network algorithm structure of the first language model and the second language model can be CNN (Convolutional Neural Network), RNN (Recurrent Neural Network), LSTM (Long Short-Term Memory), etc., or it can be a model built with an attention network, such as transformer (converter network model), BERT (Bidirectional Encoder Representations from Transformers), GPT (Generative Pre-trained Transformer), Clip (Contrastive Language–Image Pre-training), etc., which is not limited in this application. Attention network refers to a network model that uses the attention mechanism for training. The model assigns different weights to each part of the input sequence, thereby extracting more important feature information from the input sequence, so that the model ultimately obtains more accurate output.

[0046] Among them, the reasoning task training sample set is a training sample set that matches the task to be processed, which may include a large number of reasoning task data samples to provide high-quality and diverse data support for subsequent model training. Each reasoning task data sample has a label, and the label of each reasoning task data sample at least includes questions, task execution ideas, idea adjustment process, task execution steps, step reflection process and task execution results. Reasoning task data samples can be obtained from, for example, mathematics competition data sets, open source data sets, code generation task data and high-quality mathematics corpora. For example, mathematics competition data can be crawled from international mathematics competition websites, covering multiple fields such as algebra, geometry, and combinatorial mathematics; open source data sets can use public resources such as GSM8K (dataset name) and MATH (dataset name), covering a wide range of mathematical problems and their solutions; code generation task data are collected from platforms such as LeetCode (code library name), ATCoder (code library name), and Codeforces (code library name), covering topics such as algorithms and data structures; in addition, mathematics corpora such as MathPile (corpus name) and OpenWebMath (corpus name) can be used to extract high-quality mathematical texts such as textbooks and papers to ensure the diversity and professionalism of the data.

[0047] S502: Based on the prompt word, use the first language model to generate initial idea prediction data corresponding to the question sample of the current reasoning task data sample, use the second language model and the question sample to analyze the initial idea prediction data; and use the first language model to determine the idea prediction data based on the initial idea prediction data and the idea analysis prediction result.

[0048] In this embodiment, for the sake of distinction, the task execution idea output for the first time by the first language model during the task processing model training process is defined as the initial idea prediction data, the idea analysis result generated by the second language model analyzing the initial idea prediction data is defined as the idea analysis prediction result, and the task execution idea finally determined is defined as the idea prediction data.

[0049] S503: According to the prompt word, the single initial task execution prediction step output by the first language model is analyzed based on the second language model, and the single-step analysis prediction result is obtained. The first language model is used to predict the data according to the idea, and the task execution prediction steps are gradually generated. The problem sample, the initial idea prediction data, the idea analysis prediction result, each initial task execution prediction step, the single-step analysis prediction result and each task execution prediction step are used as prediction data.

[0050] In this embodiment, for the sake of distinction, the task execution step output by the first language model for the first time during the task processing model training process is defined as the initial task execution prediction step, the step analysis result generated by the second language model analyzing the initial task execution prediction step is defined as the single step analysis prediction result, and the task execution step finally determined is defined as the task execution prediction step. For example, taking a math problem solving task as an example, the prediction data may include questions, problem-solving ideas, problem-solving steps, step reflections, and the final answer. This long-term thinking data can effectively enhance the reasoning ability of the task processing model.

[0051] S504: Based on the labels of each inference task data sample and its corresponding prediction data, the task processing model is continuously trained until a preset model training stop condition is met.

[0052] Among them, the first language model and the second language model can be directly fine-tuned by the labels of each reasoning task data sample and its corresponding prediction data. Fine-tuning refers to the use of the first language model and the second language model, for the downstream task of complex reasoning, using each reasoning task data sample as the downstream data for further small-scale training to adjust the model parameters so that it can better adapt to the complex reasoning task, and finally obtain a model adapted to the complex reasoning task and the reasoning task data sample set. In the fine-tuning process, most of the layers of the pre-trained model, that is, the first language model and the second language model, are usually frozen, and only the newly added layers are trained or a small number of key layers are adjusted. This can not only retain the useful features learned by the pre-trained model, but also quickly adapt to the specific needs of the new task. In addition, selecting an appropriate learning rate and training rounds is also the key to successful fine-tuning. The preset training stop condition can be, for example, the number of iterations reaching a preset number of iterations threshold or the model has converged or the prediction accuracy reaches a preset accuracy threshold, which does not affect the implementation of the present invention.

[0053] From the above, it can be seen that this embodiment gives the task processing model direct reasoning ability by generating long-term thinking data to train the task processing model. Compared with other reasoning enhancement methods that call the model multiple times, it can reduce a lot of computing costs. Furthermore, through the reflection method of dual-model collaboration, logical errors can be generated and corrected, and a clear reasoning chain that is more in line with the human thinking process can be generated, thereby improving the performance of the task processing model in performing complex reasoning tasks. Furthermore, through long-term thinking data training covering multiple fields such as mathematics and code, the task processing tasks can perform better in complex tasks and the generalization ability is enhanced.

[0054] It should be noted that there is no strict order of execution between the steps in the present invention. As long as they comply with the logical order, these steps can be executed simultaneously or in a certain preset order. Figure 2 and Figure 5This is just a schematic and does not mean that this is the only execution order.

[0055] In order to further improve the performance of the task processing model, based on the above embodiment, the present invention may also preprocess the reasoning task training sample set, and the preprocessing process may include:

[0056] Whenever an original reasoning task data sample is obtained, a search is performed in the current reasoning task training sample set to determine whether there is sample data identical to the original reasoning task data sample; if there is no sample data identical to the original reasoning task data sample in the current reasoning task training sample set, if there is a missing value in the original reasoning task data sample, the original reasoning task data sample is filled with data according to the data type of the original reasoning task data sample; if there is an outlier in the original reasoning task data sample, the original reasoning task data sample is adjusted according to the type of the outlier to obtain the reasoning task data sample; the reasoning task data sample is converted into a target format and stored in the current reasoning task training sample set.

[0057] In this embodiment, the acquired original reasoning task data samples are cleaned, including but not limited to missing value processing, outlier detection and processing, and duplicate data deletion. For example, the Pandas library (database name) can be used to detect and process missing values, and the mean is used to fill in numerical data, and the mode is used to fill in categorical data; the IQR (Interquartile Range) method is used to detect outliers, and the data out of the range is corrected or deleted; the drop_duplicates() method (function name) of Pandas is used to delete duplicate records, and only the first occurrence of the record is retained to ensure the uniqueness of the data. For ease of management, the format of the reasoning task data samples obtained after data cleaning can be unified, such as converting fields such as dates and numbers into a unified data type, and unifying the formats of fields such as dates and currencies to ensure the readability and consistency of the data, such as Figure 6 shown.

[0058] From the above, it can be seen that this embodiment ensures the readability and consistency of the data by performing data cleaning and format unification on the reasoning task data samples, which is conducive to obtaining high-quality and diversified reasoning task data samples and improving the performance and training efficiency of the task processing model.

[0059] Considering that a large amount of storage resources are required in the model training process, in order to avoid inefficient model training or even failure due to insufficient storage resources, based on the above embodiment, the reasoning task data samples may also be stored and managed in the following manner, which may include the following contents: Obtain data reading parameters; according to the data reading parameters, read data samples of the corresponding number of rows from the inference task training sample set, and load them into the memory as data sample blocks.

[0060] The data reading parameters include the number of rows read each time. For example, you can set the chunksize parameter (parameter name). The chunksize parameter is used to specify the number of rows read each time. When chunksize is set, the read_csv() method (function name) returns an iterable object, which can be iterated to process data block by block. The block data of the inference task data sample can be uniformly stored in CSV (format name), JSON (format name) or database format for subsequent use.

[0061] It can be seen from the above that this embodiment can avoid memory overflow by reading data in blocks, thereby ensuring the training effect of the task processing model.

[0062] In order to further improve the performance of the task processing model, based on the above embodiment, the present invention also provides a sample screening embodiment, which may include the following contents: If the current reasoning task data sample belongs to the first task type, then when the task execution result of the current reasoning task data sample is not completely consistent with the execution prediction steps of each task, the current reasoning task data sample is marked as an error sample, and the current reasoning task data sample is deleted from the reasoning task training sample set; if the current reasoning task data sample belongs to the second task type, then when the task execution result of the current reasoning task data sample does not match the execution prediction steps of each task, and / or each task execution prediction step cannot pass the corresponding correctness verification condition, then the current reasoning task data sample is marked as an error sample, and the current reasoning task data sample is deleted from the reasoning task training sample set.

[0063] In this embodiment, the prediction data can be saved in a structured format, such as including six fields: "problem-solving ideas-thinking reflection-solving steps-step reflection-final answer". For example, if the task to be processed is "solving the equation x^2-5x+6=0", the data format of the prediction data is, for example: Problem: Solve the equation x^2-5x+6=0. Initial thinking prediction data: Use the factorization method to decompose the equation into two first-order factors, and then solve the roots. Thinking analysis prediction results: The above analysis score is 8 points. The factorization method is applicable to this equation, but it is necessary to clearly point out that the equation can be decomposed into (x-2)(x-3)=0, and explain how to obtain the roots by factorization. Task execution steps: Step 1, decompose the equation x^2-5x+6=0 into (x-2)(x-3)=0; Step 2, solve the equation (x-2)=0, and get x=2; Step 3, solve the equation (x-3)=0, and get x=3. Step reflection: Step 1 is scored 9 points, Step 2 is scored 10 points, and Step 3 is scored 10 points. Final answer: \(\boxed{2},\boxed{3}\).

[0064] Among them, the first task type is a task that does not need to verify the effect, but only needs to compare whether the correct answer in the label is consistent with the predicted answer, such as a math problem-solving task. The second task type is a task that not only compares whether the correct answer in the label is consistent with the predicted answer, but also needs to verify the effect of the generated content, such as a code generation task. For example, if the task to be processed is a math problem-solving task, and the reasoning task training sample is a math type data, it is only necessary to compare the generated predicted answer with the original answer in the label. For example, the content in the box of the final generated predicted answer (such as \(\boxed{2}, \boxed{3}\)) can be extracted and compared with the original answer in the label. If the two are completely consistent, the data is retained; otherwise, it is marked as an error and deleted from the reasoning task training sample set. For example, if the original answer in the label is \(\boxed{2}, \boxed{3}\), and the generated predicted answer is \(\boxed{2}, \boxed{4}\), then the data will be filtered out. If the task to be processed is a code generation task, it is also necessary to verify the correctness of the generated code through the test case in the label. That is, the club will compare the generated code with the code in the label, or match it with the test case, and run the code to check whether it passes all test cases. If the generated code can pass all test cases, the data is retained; if the generated code cannot pass all test cases, it is marked as an error and removed. For example, if the label contains the test case "input: [1, 2, 3] output: 6", and the generated code outputs 5 when the input is [1, 2, 3], then the data will be deleted from the inference task training sample set.

[0065] For example, through the above method, the prediction data is saved in a structured format in JSON format: ```JSON { "problem": "Solve the equation \(x^2-5x+6=0\)", "solution_idea": "Use factorization to decompose the equation into two linear factors and then solve the roots.", "idea_feedback" (i.e., predicted result of idea analysis): "The above analysis score is 8 points. Modification suggestion: Factorization method is applicable to this equation, but it is necessary to clearly point out that the equation can be decomposed into \((x-2)(x-3)=0\) and explain how to obtain the root through factorization.", "steps (i.e. initial task execution prediction steps)": [ {"step":"Step 1 decomposes the equation \(x^2-5x+6=0\) into \((x-2)(x-3)=0\)","step_feedback" (i.e., the prediction result of single-step analysis):"The score of step 1 is 9 points."}, {"step":"Step 2 solves the equation \((x-2)=0\) to get \(x=2\)","step_feedback":"Step 2 scores 10 points."}, {"step":"Step 3 solves the equation \((x-3)=0\) to get \(x=3\)","step_feedback":"Step 3 scores 10 points."} ], "final_answer" (i.e., the result of task processing): "\(\boxed{2},\boxed{3}\)" } ```.

[0066] From the above, we can see that on the basis of using the generated long-thinking data to improve the reasoning ability of the task processing model in complex tasks such as mathematics and code, the correct long-thinking data is filtered out by comparing the generated final answer with the answer in the label to train the task processing model. The code type data is filtered through test case verification to ensure functional correctness. Ultimately, the accuracy, practicality and logical rigor of the generated long-thinking data can be ensured, the quality of the generated data can be improved, and high-quality learning samples can be provided for model training, thereby improving the reasoning ability of the task processing model.

[0067] The above embodiment does not limit how to train the task processing model. Based on the above embodiment, the present invention also provides an exemplary training method for the task processing model, which may include the following contents: When the difference between the label of each reasoning task data sample and its corresponding predicted data is minimized and the preset training effect conditions are met, the initial task processing model is obtained; the reward score of the predicted data of each reasoning task data sample is determined according to the preset reward rules, and based on the label of each reasoning task data sample, the corresponding predicted data and its reward score, the initial task processing model is continuously adjusted until the preset model training stop conditions are met to obtain a trained task processing model.

[0068] In this embodiment, the reasoning task data sample is long-term thinking data, that is, long-term thinking data such as questions, problem-solving ideas, reflection on ideas, problem-solving steps, step reflections and final answers, which are unified into a structured format, and ensure that each reasoning task data sample contains a complete reasoning chain and fine-grained supervision signals. The task processing model is built based on the first language model and the second language model, and the pre-trained weights are loaded. Based on pre-configured training parameters, such as learning rate (such as 2e-5), batch size (such as 32) and training cycle (such as 3 epochs), each reasoning task data sample is used to supervise and fine-tune the task processing model, and the optimization goal is to minimize the difference between the generated reasoning chain prediction data and the corresponding label, ensuring that the task processing model can fully learn the logical structure and details of the reasoning chain. During the fine-tuning process, the model performance of the task processing model is regularly evaluated on the validation set, and indicators such as accuracy and / or reasoning chain integrity are used to monitor the training effect. If overfitting or performance degradation occurs during the training of the task processing model, the learning rate can be adjusted or the data diversity can be increased. After the model is initially optimized using long-term thinking data, reinforcement learning is performed on the basis of supervised fine-tuning, and dynamic rewards are used to guide the task processing model to generate higher quality reasoning chains, thereby further optimizing the reasoning ability of the task processing model.

[0069] As an exemplary reward method, the first reward score of each reasoning task data sample can be determined according to the difference between the task execution prediction step and the task execution result of each reasoning task data sample; the second reward score of each reasoning task data sample can be determined according to the difference between the format of the predicted data of each reasoning task data sample and the preset output format; the reward score of each reasoning task data sample can be determined according to the first reward score and the second reward score of each reasoning task data sample; for the first category of reasoning task data samples whose reward scores are greater than or equal to the preset reward threshold, the task processing model is trained using a positive gradient based on the labels of each first category of reasoning task data samples and their corresponding prediction data; for the second category of reasoning task data samples whose reward scores are less than the preset reward threshold, the task processing model is trained using a negative gradient based on the labels of each second category of reasoning task data samples and their corresponding prediction data.

[0070] In this embodiment, the bonus score may include an accuracy bonus score and a format bonus score. The accuracy bonus score is used to evaluate whether the final answer generated by the model is correct, such as whether the answer to a math problem is in the box; the format bonus score is used to ensure that the reasoning process meets the structural requirements, such as clear steps and logical coherence. The preset bonus threshold can be flexibly determined according to the actual situation. A positive gradient is given if the bonus score is high, and a negative gradient is given if the bonus score is low. For example, if the task to be processed is a math problem-solving task, the accuracy bonus score can be calculated by comparing the generated final answer with the standard answer in the label, and the format bonus score can be determined based on the integrity and logical coherence of the reasoning chain. After the bonus score is determined, the model parameters and experience priorities will be dynamically updated during the training process to maximize the reward signal. The advantage function can be calculated by combining PPO (Proximal Policy Optimization, a reinforcement learning algorithm based on policy gradient) with GAE (Generalized Advantage Estimation, an advantage function estimation method used in reinforcement learning) to ensure that the performance of the task processing model in the reasoning task is steadily improved.

[0071] From the above, it can be seen that this embodiment trains the task processing model through two training stages: supervised fine-tuning and reinforcement learning. It combines the supervisory signal of high-quality data and the dynamically optimized reward mechanism, and makes full use of long-term thinking data to significantly improve the accuracy of the task processing model in handling complex reasoning tasks, ensuring that the performance of the task processing model in reasoning tasks reaches the optimal level.

[0072] In order to further improve the accuracy of the task processing model in generating answers to mathematical logic tasks, the reasoning task training sample set based on the above embodiment may further include a numerical operation data set. An exemplary generation process of the numerical operation data set is as follows: By changing the numerical value and operator of the target numerical operation relation, multiple original question data are generated; for the mixed operation in each original question data, the operator with the highest current priority is calculated from left to right for each operation, and the calculation results of each original question data are gradually obtained; the original question data is taken as the question, the calculation result of the original question data is taken as the correct answer, and the calculation process of the original question data is taken as the answer parsing process, as a group of numerical operation data; based on each group of numerical operation data, a numerical operation data set is constructed.

[0073] In this embodiment, the target numerical operation expression is any acquired or existing numerical operation relational expression, which may be a unary operation relational expression, a binary operation relational expression or a mixed operation relational expression. The value is any number in the target numerical operation expression. The operation of changing the operator and the value includes modification, addition or deletion. There are many target numerical operation relations. The original problem data is the operation relational expression obtained after changing the value and / or operator of the target data operation expression. Among them, as an efficient and simple way to generate original question data: multiple binary operation relational expressions can be obtained, such as: A+B, AB, A+BC, A*B+C, A*(B+C), and the letters of at least one binary operation relational expression are replaced with random values, which can be random integers, decimals, and fractions, which do not affect the implementation of the present invention, to generate binary operation data; a unary operator is randomly set on at least one value of each binary operation data, that is, a unary operator is added before the integer, decimal, and fraction of the binary operation data to obtain multiple original question data. For example, the binary operation data is A+BC, and a unary operator sin is added before B, and the generated original question data is: "A+sin(B)-C", the binary operation data is A*B+C, and a unary operator is added after C, and the generated original question data is: "A*B+C!", where "!" is a unary operator, indicating a logical NOT operation. Among them, it is more convenient to pre-construct a binary operation template, and directly obtain the binary operation relational expression from the binary operation template. In order to further improve the efficiency of constructing numerical calculation data sets, technicians in this field can also expand and process current open source mathematical logic databases, such as bella (database name), gsm8k (database name), ape (database name), and blossom (database name), according to the above method.

[0074] After the original problem data is generated, according to the operation laws, rules and calculation priorities of the operators, detailed solution steps need to be listed. The generation of detailed solution steps can be achieved by combining the infix-postfix expression conversion method. Each calculation only calculates the operation relationship with the highest priority in the current step, and gradually advances until the calculation obtains the final result. For unary operations, the results can be calculated directly. For binary operations, the calculation results of each original problem data are gradually obtained by calculating the operator with the highest priority from left to right in each operation. For example, the calculation process of the calculation result is: 5×7+3+9 / 3+2.5**(3-1)=35+3+9 / 3+2.5**(3-1)=38+9 / 3+2.5**(3-1)=38+3+2.5**(3-1)=41+2.5**(3-1)=41+2.5**2=41+6.25=47.25.

[0075] From the above, it can be seen that this embodiment obtains a numerical operation data set by constructing original problem data in the reasoning task training sample set, and implementing detailed solution steps by converting the original problem data into infix-postfix expressions, so that the task processing model can learn the mapping relationship from input questions to output answers, thereby having the ability to perform numerical calculation tasks, improving the correctness of the task processing model for basic addition, subtraction, multiplication and division operations and complex mixed operations, and is conducive to improving the accuracy of the execution of more complex logical reasoning tasks.

[0076] Through the description of the above implementation, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation. The present invention also provides a corresponding device for the reasoning task execution method, which further makes the method more practical. Among them, the device can be described from the perspective of functional modules and hardware. The following is an introduction to the reasoning task execution device provided by the present invention, which is used to implement the reasoning task execution method provided by the present invention. In this embodiment, the reasoning task execution device may include or be divided into one or more program modules, which are stored in a storage medium and executed by one or more processors to complete the reasoning task execution method disclosed in the first embodiment. The program module referred to in this embodiment refers to a series of computer program instruction segments that can complete specific functions, which is more suitable for describing the execution process of the reasoning task execution device in the storage medium than the program itself. The following description will specifically introduce the functions of each program module in this embodiment, and the reasoning task execution device described below and the reasoning task execution method described above can be referred to in correspondence with each other.

[0077] From the perspective of functional modules, see Figure 7 , Figure 7 A schematic diagram of the structural framework of a reasoning task execution device provided in this embodiment in one implementation manner, the device may include: The task input module 701 is used to input the task to be processed and the prompt word into a pre-trained task processing model; the task processing model includes a first language model and a second language model.

[0078] The idea determination module 702 is used to generate an initial task execution idea corresponding to the task to be processed using the first language model according to the prompt word, analyze the initial task execution idea using the second language model and the task to be processed, and determine the task execution idea based on the initial task execution idea and the idea analysis result using the first language model.

[0079] The task execution module 703 is used to analyze the single initial task execution step output by the first language model based on the prompt word and the second language model to obtain the single step analysis result, and use the first language model to gradually generate each task execution step according to the task execution idea.

[0080] Exemplarily, in some implementations of this embodiment, the idea determination module 702 can also be used to: score the initial task execution idea using the second language model and idea analysis prompt words, and output task execution idea modification suggestions based on the task to be processed and the initial task execution idea; wherein the idea analysis prompt words are used to prompt the second language model to score the initial task execution idea and give idea modification suggestions.

[0081] As an exemplary implementation method of the above embodiment, the above idea determination module 702 can also be used for: if the score of the initial task execution idea is lower than the preset idea qualified score threshold, the first language model regenerates the task execution idea according to the task execution idea modification opinion; if the score of the initial task execution idea is not lower than the preset idea qualified score threshold, the initial task execution idea is used as the task execution idea.

[0082] Exemplarily, in some other implementations of the present embodiment, the task execution module 703 may also be used to: generate the current task execution steps for executing the pending task according to the generated content using the first language model based on the pending task and the task execution idea, and output them according to the generated format; input the pending task, the task execution idea and the current task execution steps as step reflection data into the second language model; use the second language model to score the current task execution steps according to the step reflection prompt words, and give step modification suggestions; if the score of the current task execution step is lower than the preset step passing score threshold, the first language model regenerates the current task execution steps based on the step modification suggestions and the step regeneration prompt words; wherein the step reflection prompt words are used to prompt the second language model to score the last task execution step output by the first language model, and give step modification suggestions.

[0083] Exemplarily, in some other implementations of the present embodiment, the task execution module 703 may also be used for: if the number of current task execution steps is greater than the total number of steps generated, all currently generated task execution steps are output as task execution results; if the number of current task execution steps is less than or equal to the total number of steps generated, according to the task to be processed and the task execution idea, the first language model is used to generate the current task execution steps for executing the task to be processed according to the generated content in the prompt word, and the steps are output according to the generated format in the prompt word; the task to be processed, the task execution idea and the current task execution step are input as step reflection data to the second language model, and when the score of the current task execution step is less than the preset step passing score threshold, the current task execution step is regenerated using the first language model; if the current task execution step is the last step, all currently generated task execution steps are output as task execution results; if the current task execution step is not the last step, according to the task to be processed and the task execution idea, the first language model is used to generate the next task execution step of the current task execution step according to the generated content.

[0084] Exemplarily, in some other implementations of the present embodiment, the above-mentioned task execution module 703 can also be used for: if the number of current task execution steps generated by the first language model is less than the number of reflections + 1, then the pending task, task execution ideas and current task execution steps are input into the second language model as step reflection data; the second language model is used to score the current task execution steps according to the step reflection prompt words, and step modification suggestions are given; if the score of the current task execution step is lower than the preset step passing score threshold, the first language model regenerates the current task execution steps according to the step modification suggestions; if the number of current task execution steps generated by the first language model is equal to the number of reflections + 1, and the current task execution step is not the last step, then according to the pending task and the task execution ideas, the first language model is used to generate the next task execution step of the current task execution step according to the generated content in the prompt words.

[0085] From the perspective of functional modules, see Figure 8 , Figure 8 A schematic diagram of a structural framework of the inference task execution device provided in this embodiment under another implementation mode, the device may include: The sample input module 801 is used to input the reasoning task training sample set and prompt words into a pre-built task processing model. The task processing model includes a first language model and a second language model that have been pre-trained. The labels of each reasoning task data sample in the reasoning task training sample set include at least questions, task execution ideas, idea adjustment process, task execution steps, step reflection process and task execution results.

[0086] The model training module 802 is used to generate initial idea prediction data corresponding to the problem sample of the current reasoning task data sample using the first language model according to the prompt word, and analyze the initial idea prediction data using the second language model and the problem sample; and determine the idea prediction data according to the initial idea prediction data and the idea analysis prediction result using the first language model; according to the prompt word, analyze the single initial task execution prediction step output by the first language model based on the second language model, and obtain the single step analysis prediction result, and use the first language model according to the idea prediction data to gradually generate task execution prediction steps, and use the problem sample, the initial idea prediction data, the idea analysis prediction result, each initial task execution prediction step, the single step analysis prediction result and each task execution prediction step as the prediction data; based on the label of each reasoning task data sample and its corresponding prediction data, continuously train the task processing model until the preset model training stop condition is met.

[0087] Exemplarily, in some implementations of this embodiment, the above-mentioned device may also include a data loading module, which may also be used to: obtain data reading parameters; the data reading parameters include the number of rows read each time; according to the data reading parameters, read data samples of the corresponding number of rows from the inference task training sample set, and load them into the memory as a data sample block.

[0088] Exemplarily, in some other implementations of the present embodiment, the above-mentioned device may also include a sample collection module, which may also be used for: whenever an original reasoning task data sample is obtained, searching whether there is sample data identical to the original reasoning task data sample in the current reasoning task training sample set; if there is no sample data identical to the original reasoning task data sample in the current reasoning task training sample set, if there is a missing value in the original reasoning task data sample, then filling the original reasoning task data sample with data according to the data type of the original reasoning task data sample; if there is an outlier in the original reasoning task data sample, then adjusting the original reasoning task data sample according to the type of the outlier to obtain the reasoning task data sample; converting the reasoning task data sample into a target format, and storing it in the current reasoning task training sample set.

[0089] Exemplarily, in some other implementations of the present embodiment, the above-mentioned device may also include a sample collection module, which may also be used for: if the current reasoning task data sample belongs to the first task type, then when the task execution result of the current reasoning task data sample is not completely consistent with each task execution prediction step, mark the current reasoning task data sample as an error sample, and delete the current reasoning task data sample from the reasoning task training sample set; if the current reasoning task data sample belongs to the second task type, then when the task execution result of the current reasoning task data sample does not match each task execution prediction step, and / or each task execution prediction step cannot pass the corresponding correctness verification condition, then mark the current reasoning task data sample as an error sample, and delete the current reasoning task data sample from the reasoning task training sample set.

[0090] Exemplarily, in some other implementations of the present embodiment, the above-mentioned model training module 802 can also be used for: when minimizing the difference between the label of each reasoning task data sample and its corresponding predicted data and satisfying the preset training effect conditions, an initial task processing model is obtained; determining the reward score of the predicted data of each reasoning task data sample according to a preset reward rule, and continuously adjusting the initial task processing model based on the label of each reasoning task data sample, the corresponding predicted data and its reward score, until the preset model training stop conditions are met to obtain a trained task processing model.

[0091] As an exemplary implementation of the above embodiment, the above model training module 802 can also be used to: determine the first reward score of each reasoning task data sample according to the difference between the task execution prediction step and the task execution result of each reasoning task data sample; determine the second reward score of each reasoning task data sample according to the difference between the format of the predicted data of each reasoning task data sample and the preset output format; determine the reward score of each reasoning task data sample according to the first reward score and the second reward score of each reasoning task data sample; for the first category of reasoning task data samples whose reward scores are greater than or equal to the preset reward threshold, based on the labels of each first category of reasoning task data samples and their corresponding predicted data, a positive gradient training task processing model is adopted; for the second category of reasoning task data samples whose reward scores are less than the preset reward threshold, based on the labels of each second category of reasoning task data samples and their corresponding predicted data, a negative gradient training task processing model is adopted.

[0092] The reasoning task execution device mentioned above is described from the perspective of functional modules. Furthermore, the present invention also provides an electronic device, which is described from the perspective of hardware. Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention in one implementation mode. The electronic device includes a memory 901 and a processor 902, wherein the memory 901 stores a computer program, and the processor 902 is configured to run the computer program to execute the steps in any of the above-mentioned inference task execution method embodiments.

[0093] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned inference task execution method embodiments when running.

[0094] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0095] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned inference task execution method embodiments are implemented.

[0096] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, the non-volatile computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned reasoning task execution method embodiments are implemented.

[0097] The above is a detailed introduction to a method for executing a reasoning task, an electronic device, a computer-readable storage medium, and a computer program product provided by the present invention. The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can refer to each other. Whether the units and algorithm steps of each example described in each disclosed embodiment are executed in electronic hardware or computer software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods for each specific application to implement the described functions, and such implementation should not be considered to exceed the scope of the present invention. Without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

Claims

1. A method for executing an inference task, characterized in that: include: Input the task to be processed and the prompt word into the pre-trained task processing model; The task processing model includes a first language model and a second language model; According to the prompt word, using the first language model to generate an initial task execution idea corresponding to the task to be processed, using the second language model and the task to be processed to analyze the initial task execution idea, and using the first language model to determine the task execution idea according to the initial task execution idea and the idea analysis result; According to the prompt word, based on the single-step analysis result output by the second language model, the first language model is used to gradually generate each task execution step according to the task execution idea; the single-step analysis result is obtained by analyzing the single initial task execution step output by the first language model.

2. The method for executing an inference task according to claim 1, characterized in that: The prompt words at least include prompt words for thought analysis, the parameter amount of the second language model is greater than the parameter amount of the first language model, and the initial task execution thought is analyzed by using the second language model and the task to be processed, including: Using the second language model and the idea analysis prompt words, scoring the initial task execution idea, and outputting task execution idea modification suggestions based on the task to be processed and the initial task execution idea; The idea analysis prompt words are used to prompt the second language model, score the initial task execution idea, and provide idea modification suggestions.

3. The method for executing an inference task according to claim 2, characterized in that: Determining a task execution idea according to the initial task execution idea and the idea analysis result by using the first language model includes: If the score of the initial task execution idea is lower than the preset idea passing score threshold, the first language model regenerates the task execution idea according to the task execution idea modification suggestion; If the score of the initial task execution idea is not lower than the preset idea qualification score threshold, the initial task execution idea is used as the task execution idea.

4. The method for executing an inference task according to claim 1, characterized in that: The prompt words at least include generated content, generated format and step reflection prompt words. According to the prompt words, based on the single-step analysis result output by the second language model, the first language model is used to gradually generate each task execution step according to the task execution idea, including: According to the task to be processed and the task execution idea, using the first language model according to the generated content, generating current task execution steps for executing the task to be processed, and outputting them according to the generated format; Input the pending task, the task execution idea and the current task execution steps as step reflection data into the second language model; Using the second language model to score the current task execution step according to the step reflection prompt words, and giving step modification suggestions; if the score of the current task execution step is lower than the preset step passing score threshold, the first language model regenerates the current task execution step based on the step regeneration prompt words according to the step modification suggestions; The step reflection prompt word is used to prompt the second language model to score the last task execution step output by the first language model and provide step modification suggestions.

5. The method for executing an inference task according to any one of claims 1 to 4, characterized in that: The prompt word at least includes the total number of steps generated. According to the prompt word, based on the single-step analysis result output by the second language model, and using the first language model according to the task execution idea, each task execution step is gradually generated, including: If the number of current task execution steps is greater than the total number of steps generated, all currently generated task execution steps are output as task execution results; If the number of execution steps of the current task is less than or equal to the total number of steps generated, according to the task to be processed and the task execution idea, using the first language model and the generated content in the prompt word, generate the current task execution steps for executing the task to be processed, and output them according to the generated format in the prompt word; The task to be processed, the task execution idea and the current task execution step are input into the second language model as step reflection data, and when the score of the current task execution step is less than a preset step passing score threshold, the current task execution step is regenerated using the first language model; If the current task execution step is the last step, all currently generated task execution steps are output as the task execution result; if the current task execution step is not the last step, based on the task to be processed and the task execution idea, the first language model is used to generate the next task execution step of the current task execution step according to the generated content.

6. The method for executing an inference task according to any one of claims 1 to 4, characterized in that: The prompt word at least includes the number of reflections. According to the prompt word, based on the single-step analysis result output by the second language model, and using the first language model according to the task execution idea, each task execution step is gradually generated, including: If the number of execution steps of the current task generated by the first language model is less than the number of reflections+1, the task to be processed, the task execution idea and the current task execution steps are input into the second language model as step reflection data; Using the second language model to score the current task execution step according to the step reflection prompt words, and giving step modification suggestions; if the score of the current task execution step is lower than the preset step passing score threshold, the first language model regenerates the current task execution step according to the step modification suggestions; If the number of current task execution steps generated by the first language model is equal to the number of reflections + 1, and the current task execution step is not the last step, then according to the task to be processed and the task execution idea, the first language model is used to generate the next task execution step of the current task execution step according to the generated content in the prompt word.

7. A method for executing an inference task, characterized in that: include: Inputting the reasoning task training sample set and the prompt words into a pre-built task processing model, wherein the task processing model includes a first language model and a second language model that have been pre-trained, and the labels of each reasoning task data sample in the reasoning task training sample set at least include questions, task execution ideas, idea adjustment process, task execution steps, step reflection process, and task execution results; According to the prompt word, using the first language model to generate initial idea prediction data corresponding to the question sample of the current reasoning task data sample, using the second language model and the question sample to analyze the initial idea prediction data; and using the first language model to determine the idea prediction data according to the initial idea prediction data and the idea analysis prediction result; According to the prompt word, a single initial task execution prediction step output by the first language model is analyzed based on the second language model, and the single-step analysis prediction result is obtained, and the first language model is used to predict the data according to the idea, and the task execution prediction steps are gradually generated, and the problem sample, the initial idea prediction data, the idea analysis prediction result, each initial task execution prediction step, the single-step analysis prediction result and each task execution prediction step are used as prediction data; Based on the labels of each inference task data sample and its corresponding prediction data, the task processing model is continuously trained until a preset model training stop condition is met.

8. The method for executing an inference task according to claim 7, characterized in that: Before inputting the inference task training sample set and prompt words into the pre-built task processing model, it also includes: Obtaining data reading parameters; the data reading parameters include the number of rows read each time; According to the data reading parameters, data samples of a corresponding number of rows are read from the inference task training sample set, and loaded into the memory as data sample blocks.

9. The method for executing an inference task according to claim 7, characterized in that: Before inputting the inference task training sample set and prompt words into the pre-built task processing model, it also includes: Whenever an original reasoning task data sample is obtained, a search is performed in the current reasoning task training sample set to determine whether there is sample data identical to the original reasoning task data sample; When there is no sample data identical to the original reasoning task data sample in the current reasoning task training sample set, if there is a missing value in the original reasoning task data sample, then the original reasoning task data sample is filled with data according to the data type of the original reasoning task data sample; if there is an abnormal value in the original reasoning task data sample, then the original reasoning task data sample is adjusted according to the abnormal value type to obtain the reasoning task data sample; The reasoning task data sample is converted into a target format and stored in the current reasoning task training sample set.

10. The method for executing an inference task according to claim 7, characterized in that: After the step-by-step generation of task execution prediction steps, it also includes: If the current reasoning task data sample belongs to the first task type, when the task execution result of the current reasoning task data sample is not completely consistent with each task execution prediction step, mark the current reasoning task data sample as an error sample, and delete the current reasoning task data sample from the reasoning task training sample set; If the current reasoning task data sample belongs to the second task type, when the task execution result of the current reasoning task data sample does not match the task execution prediction steps, and / or the task execution prediction steps cannot pass the corresponding correctness verification conditions, the current reasoning task data sample is marked as an error sample and the current reasoning task data sample is deleted from the reasoning task training sample set.

11. The method for executing an inference task according to any one of claims 7 to 10, characterized in that: Based on the labels of each inference task data sample and its corresponding prediction data, the task processing model is continuously trained until a preset model training stop condition is met, including: When the difference between the label of each inference task data sample and its corresponding predicted data is minimized and the preset training effect conditions are met, the initial task processing model is obtained; The reward score of the predicted data of each reasoning task data sample is determined according to the preset reward rules. Based on the label of each reasoning task data sample, the corresponding predicted data and its reward score, the initial task processing model is continuously adjusted until the preset model training stop condition is met to obtain a trained task processing model.

12. The method for executing an inference task according to claim 11, characterized in that: Based on the labels of each reasoning task data sample, the corresponding prediction data and its reward score, the initial task processing model is continuously adjusted, including: Determine a first reward score for each reasoning task data sample according to the difference between the task execution prediction step and the task execution result of each reasoning task data sample; Determining a second reward score for each reasoning task data sample according to a difference between a format of the predicted data of each reasoning task data sample and a preset output format; Determine a reward score for each reasoning task data sample according to the first reward score and the second reward score of each reasoning task data sample; For the first-category reasoning task data samples whose reward scores are greater than or equal to the preset reward threshold, the task processing model is trained using forward gradient based on the labels of each first-category reasoning task data sample and its corresponding prediction data; For the second type of reasoning task data samples whose reward scores are less than the preset reward threshold, the task processing model is trained using negative gradient based on the labels of each second type of reasoning task data sample and its corresponding prediction data.

13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for executing an inference task as claimed in any one of claims 1 to 12 when executing the computer program.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the reasoning task execution method according to any one of claims 1 to 12 are implemented.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the reasoning task execution method according to any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Clinical case analysis problem generation method based on multiple rounds of prompts

    CN118014083A

  • Language model Chinese spelling checking method and system based on retrieval enhancement generation

    CN118586384A

  • Multi-agent thinking chain negotiation enhancement generation method

    CN118821834A

  • Large language model driven structured data interaction extraction and transformation system and method thereof

    CN119003711A

  • Semantic execution-based large model reasoning capability enhancement method and system

    CN119204226A

Cited By

  • Database question and answer model training method and device, storage medium and computer equipment

    CN120822571A