Task reasoning control method and electronic equipment
By combining the inference results of the first model with consistency information, the predicted probability distribution is determined, and it is decided whether to adopt a target processing method that is higher than that of the first and second models. This solves the problem of how to reasonably control and optimize the processing in task inference scenarios, and improves accuracy and efficiency.
Patent Information
- Application Number
- CN202610128753.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-29
- Publication Date
- 2026-04-21
AI Technical Summary
In task-based reasoning scenarios, how can we reasonably control the optimization of reasoning tasks to improve accuracy and reduce resource consumption?
By using the first model to determine the inference results and combining consistency information and predicted probability distribution, it is determined whether to use the objective processing method to process the inference task. The objective processing method has a higher task inference capability than the first model and the second model.
It achieves the goal of ensuring the accuracy of reasoning while rationally controlling and optimizing the process, reducing resource waste, and improving the efficiency of task reasoning.
Smart Images

Figure CN121903012A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a task reasoning control method and an electronic device. Background Technology
[0002] In task-based reasoning scenarios, models can be used to perform reasoning on inference tasks and obtain inference results. In some scenarios, to improve the accuracy of the inference results, there may be a need to optimize the inference task one or more times after the model has derived the result. However, each optimization of the inference task requires a certain amount of time and resources. Therefore, how to reasonably control the optimization of the inference task is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0003] On the one hand, this application provides a task reasoning control method, including:
[0004] Based on the prompts for the reasoning task, the reasoning result of the reasoning task is determined using the first model;
[0005] Obtain consistency information, which indicates whether the second model passes the verification of the inference result, and the parameter size of the second model is larger than that of the first model;
[0006] Based on the inference results and consistency information, a predicted probability distribution is determined. The distribution parameters of the predicted probability distribution are used to characterize the probability that the inference task needs to be processed using a target processing method. The task inference capability of the target processing method is higher than that of the first model and the second model.
[0007] If the target processing method is determined to be required based on the predicted probability distribution, the inference task is processed using the target processing method.
[0008] In one possible implementation, determining the predicted probability distribution based on the inference result and consistency information includes:
[0009] Obtain the probability data on which the first model infers the inference result, the probability data including: the probability of at least one candidate result inferred by the first model, the inference result being one of the at least one candidate result;
[0010] Based on the consistency information and the probability data, the predicted probability distribution is determined.
[0011] In yet another possible implementation, determining the predicted probability distribution based on the consistency information and the probability data includes:
[0012] Based on the probability data, a first probability corresponding to the reasoning result and a second probability corresponding to the target candidate result are determined. The target candidate result is a candidate result whose probability is only lower than the first probability in the probability data.
[0013] The predicted probability distribution is determined based on the first probability, the difference between the first probability and the second probability, and the consistency information.
[0014] In another possible implementation, determining the predicted probability distribution based on the first probability, the difference between the first probability and the second probability, and the consistency information includes:
[0015] The first probability and the second probability are subjected to nonlinear transformation processing respectively to obtain the transformed first probability and the transformed second probability. For any one of the first probability and the second probability, the larger the absolute value of the difference between the probability and the target threshold, the larger the scaling ratio of the probability by the nonlinear transformation.
[0016] The predicted probability distribution is determined based on the transformed first probability, the difference between the transformed first probability and the transformed second probability, and the consistency information.
[0017] In another possible implementation, determining the predicted probability distribution based on the inference result and consistency information includes:
[0018] Based on the inference results and consistency information, a prediction probability distribution is determined using a Bayesian model. The Bayesian model includes a parameter value matrix of at least one parameter, and the prediction probability distribution includes at least one prediction probability calculated based on the parameter value matrix of at least one parameter.
[0019] In another possible implementation, the Bayesian model is obtained by training and adjusting the parameter value matrix based on the sample inference results and sample consistency information of at least one sample inference task, combined with the sample decision results labeled by the sample inference task.
[0020] Wherein, the sample consistency information is used to characterize whether the second model passes the verification of the sample inference result; the sample inference result is the inference result of the sample inference task determined by the first model;
[0021] The sample decision result is used to characterize whether the target processing method is adopted to process the sample reasoning task.
[0022] In another possible implementation, determining the target processing method to be used based on the predicted probability distribution includes:
[0023] Determine the value of the target quantile in the predicted probability distribution;
[0024] If the value is not less than the set threshold, it is determined that the inference task needs to be processed using the target processing method.
[0025] In another possible implementation, the mean of the predicted probability distribution represents the likelihood that the inference task needs to be handled using a target processing method; the variance of the predicted probability distribution represents the uncertainty corresponding to the likelihood represented by the mean.
[0026] In another possible implementation, the set threshold is determined based on a first factor and a second factor. The first factor represents the impact of an incorrect inference result without further processing using the target processing method on the overall accuracy, while the second factor represents the impact of a correct inference result but still requiring further processing using the target processing method on efficiency.
[0027] In another aspect, this application also provides an electronic device, including: at least one processor and at least one memory;
[0028] The memory is used to store the computer programs required for the processor to perform operations;
[0029] The processor is configured to run the computer program to perform the following operations:
[0030] Based on the prompts for the reasoning task, the reasoning result of the reasoning task is determined using the first model;
[0031] Obtain consistency information, which indicates whether the second model passes the verification of the inference result, and the parameter size of the second model is larger than that of the first model;
[0032] Based on the inference results and consistency information, a predicted probability distribution is determined. The distribution parameters of the predicted probability distribution are used to characterize the probability that the inference task needs to be processed using a target processing method. The task inference capability of the target processing method is higher than that of the first model and the second model.
[0033] If the target processing method is determined to be required based on the predicted probability distribution, the inference task is processed using the target processing method. Attached Figure Description
[0034] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0035] Figure 1 A flowchart illustrating the task reasoning control method provided in this application;
[0036] Figure 2 Another flowchart illustrating the task reasoning control method provided in this application;
[0037] Figure 3 This is an example diagram comparing the predicted probability distributions, mean, and variance of three different inference results determined using a Bayesian model.
[0038] Figure 4 An example diagram showing the distribution of the first sample probability for inference results from multiple samples;
[0039] Figure 5 An example diagram showing the distribution of the first sample probability after a nonlinear transformation of the inference results for multiple samples;
[0040] Figure 6 Another flowchart illustrating the task reasoning control method provided in this application;
[0041] Figure 7 This is a diagram comparing the proportion of erroneous inference results that can be handled by using the solution in this application versus using other solutions;
[0042] Figure 8 A schematic diagram of the composition structure of an electronic device provided in this application. Detailed Implementation
[0043] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is only for explaining specific embodiments and is not intended to limit the application. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0044] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0045] like Figure 1 This illustration shows a flowchart of a task reasoning control method provided in this application. The method of this embodiment can be applied to an electronic device, which can be any electronic device with data processing capabilities, without limitation. For example, the electronic device can be a personal computer, a server, a device node in a cluster, or a device node in a distributed system, etc.
[0046] The method in this embodiment may include the following steps:
[0047] S101, Based on the prompts for the reasoning task, determine the reasoning result of the reasoning task using the first model.
[0048] The prompts for the reasoning task are used to indicate the specific task content. The reasoning result is the processing result obtained by the first model based on the prompts when performing task reasoning.
[0049] For example, if the inference task is a classification task, the prompt information will be the information indicating the classification requirement, and the inference result will be the classification result determined by the first model. If the inference task is a translation task, the prompt information can be the text information to be translated (or speech content) and instructions to translate the text information; the inference result will be the translated content. If the inference task is a question-and-answer task, the prompt information will at least include the question content, and the inference result will be the answer to the question content. Of course, there are other possibilities for inference tasks, and the corresponding prompt information and inference results can also be different, which will not be elaborated here.
[0050] S102, obtain consistency information.
[0051] The consistency information indicates whether the second model has passed the verification of the inference result.
[0052] In this application, the parameter size of the second model is larger than that of the first model. In one possible implementation, the second model is a model whose structural similarity to the first model meets the requirements, but with a larger parameter size. For example, the first and second models can be two models with the same structure but different parameter sizes developed by the same developer.
[0053] Because the second model has a relatively high parameter scale, its inference accuracy is higher than that of the first model. However, the second model also requires more time and resources to perform the inference task. Therefore, to reduce resource consumption and improve inference accuracy, this application employs a speculative decoding mechanism. After the first model infers the inference result for the inference task, the second model verifies that result.
[0054] In this application, if the second model verifies that the reasoning result is acceptable, it means that the second inference model has passed the verification of the reasoning result, which naturally indicates that the accuracy of the reasoning result inferred by the first model is relatively high. Conversely, if the second model verifies that the reasoning result is acceptable, it means that the second model has failed the verification of the reasoning result, which indicates that the reasoning result is likely to be wrong. Therefore, this consistency information can be used as a basis for judging whether the reasoning result is accurate.
[0055] In this application, there are no restrictions on the specific implementation method for obtaining the consistency information. For example, the second model can be used to verify the inference result, and the acceptable result can be compared with the inference result to obtain consistency information. If the acceptable result is consistent with the inference result, it indicates that the consistency information shows that the second model has successfully verified the inference result; otherwise, the verification has failed. Of course, there are other possibilities for obtaining the consistency information, and there are no restrictions on this.
[0056] S103. Based on the reasoning result and consistency information, determine the predicted probability distribution.
[0057] The distribution parameters of the predicted probability distribution are used to characterize the likelihood that the inference task requires a target-oriented approach. This target-oriented approach demonstrates higher task inference capabilities than the first and second models.
[0058] In this application, the target processing method is to use a processing method other than the first model and the second model, without any specific restrictions.
[0059] For example, the target processing method could be to use a third model to process the reasoning task based on the prompt word. The task reasoning ability of the third model is higher than that of the first and second models, for example, the parameter size of the third model is larger than that of the first and second models respectively.
[0060] For example, the target processing method is an advanced prompt word strategy (also known as prompt word engineering). This method optimizes the prompt information, and based on the optimized prompt information, the first model is used to reprocess the inference task to obtain a new inference result; or, based on the optimized prompt information, one or more models other than the first and second models are used to process the inference task to obtain a new inference result. In particular, after reprocessing the inference task using the first model based on the optimized prompt information, this application can repeat steps S102 and S103 until the distribution parameters of the predicted probability distribution no longer require processing the inference task using this target processing method, or the number of times the first model is used to process the inference task reaches a set number.
[0061] The advanced cue word strategy adopted in this application can be of various types, such as using Few-shot, Chain of Thought (COT), or Self-Consistency strategies to handle the reasoning task, without any specific restrictions.
[0062] Of course, there are other possible ways to handle this target, which will not be elaborated here.
[0063] In this application, the predicted probability distribution may include at least one predicted probability. The distribution parameters of the predicted probability distribution may be at least one of the parameters that characterize the distribution, such as the mean, variance, and set quantiles of the predicted probability distribution.
[0064] Understandably, compared to analyzing whether to adopt the target processing method based solely on the inference results derived from the first model, since this consistency information can serve as a basis for judging the accuracy of the inference results, combining the inference results and the consistency information can more accurately analyze whether to adopt the target processing method to handle the inference task. Naturally, this also allows the distribution parameters of the determined prediction probability distribution to more accurately reflect the possibility of adopting the target processing method.
[0065] In this application, there are several possible ways to determine the specific probability distribution for prediction.
[0066] For example, the predicted probability distribution can be determined using a model based on the inference results and consistency information; this model can be a trained artificial intelligence model for the task type. Alternatively, the predicted probability distribution can be determined using a functional model that includes multiple prediction functions, based on the inference results and consistency information.
[0067] S104. If it is determined from the predicted probability distribution that the target processing method needs to be adopted, the inference task is processed using the target processing method.
[0068] For example, if the target processing method is the advanced cue word strategy, then the advanced cue word strategy can be used to process the reasoning task, as described above, and will not be repeated here.
[0069] It is understandable that if the predicted probability distribution determines that the target processing method is not required, it means that the reasoning result of the reasoning task after processing by the first model and the second model is reliable. Therefore, the second model can be used to verify the reasoning result, and the acceptable result determined is the target reasoning result.
[0070] As can be seen from the above, after obtaining the inference result of the inference task determined by the first model, this application also obtains consistency information to characterize whether the second model's verification of the inference result passes. Based on the inference result and the consistency information, a predicted probability distribution is determined. Since the distribution parameters of this predicted probability distribution can characterize the probability that the target processing method needs to be used to process the inference task, this application can reasonably determine whether it is suitable to use the target processing method to process the target inference task based on the predicted probability distribution. If it is determined based on the predicted probability distribution that the target processing method needs to be used, the target processing method is used to process the inference task, thereby avoiding the resource consumption caused by blindly using the target processing method to process the inference task. Naturally, it can balance the accuracy of task inference and resource consumption, thus achieving more reasonable control over the optimization of the inference task.
[0071] In this application, there are many possible implementations for determining the predicted probability distribution based on inference results and consistency information, and no restrictions are imposed on them.
[0072] In one possible implementation, this application can obtain the probability data on which the first inference is based, and accordingly, the predicted probability distribution can be determined based on the consistency information and the probability data.
[0073] The probability data includes: the probability of at least one candidate result inferred by the first model, wherein the inference result inferred by the first model is one of the at least one candidate result.
[0074] For example, in a classification task scenario, the reasoning result inferred by the first model is a classification result. Correspondingly, the probability data includes the probability of this classification result and other candidate classification results.
[0075] For example, if the reasoning task is of another type, the reasoning result may include multiple tokens (e.g., a token can be called a lexicon), where a token is a smallest semantic unit. A token can be a character, a Chinese character, a word, a phrase, a punctuation mark, or a sequence of characters. In this case, the probability of each candidate result can include the probability of each candidate token within that candidate result. Correspondingly, the reasoning result belongs to at least one candidate result; therefore, the probability of the reasoning result can include the probability of each token within the reasoning result.
[0076] It is understandable that the probability data may include the probability of each candidate result obtained by the first model inference. Therefore, the probability data can reflect the probability that the inference result is the accurate inference result among multiple candidate results. Thus, by combining the probability data and consistency information to predict the probability distribution, the distribution parameters of the predicted probability distribution can more accurately reflect the possibility of needing to adopt the target processing method.
[0077] Understandably, candidate results with higher probabilities in the probability data inferred by the first model are more likely to be the inference result, and the probability difference between the two highest-probability candidate results can also reflect the reliability of the inference result inferred by the first model as an accurate result. For example, if the probability difference between the two highest-probability candidate results is large, it means that the reliability of the highest-probability candidate result as an accurate inference result inferred by the first model is relatively high; if the probability difference between the two highest-probability candidate results is small, it means that both candidate results could be the final inference result, and the reliability of the highest-probability candidate result as an accurate inference result inferred by the first model is relatively low.
[0078] Therefore, in order to further accurately determine the predicted probability distribution, this application can also determine the predicted probability distribution based on the probabilities of the two candidate results with the highest probabilities in the probability data. The following is in conjunction with... Figure 2 Please provide an explanation, such as Figure 2 This illustrates another flowchart of the task reasoning control method provided in this application. The method in this embodiment may include:
[0079] S201, Based on the prompts for the reasoning task, determine the reasoning result of the reasoning task using the first model.
[0080] S202, obtain consistency information.
[0081] The consistency information indicates whether the second model has passed the verification of the inference result.
[0082] The parameter size of the second model is larger than that of the first model.
[0083] S203, obtain the probability data on which the inference result of the first model is based.
[0084] The probability data includes the probability of at least one candidate result inferred by the first model. The inference result inferred by the first model is one of the at least one candidate result.
[0085] Understandably, during the inference task processing of the first model, a probability dataset is derived to determine the inference result. Then, based on the probabilities of each candidate result in this probability dataset, the candidate result with the highest probability is determined as the inference result. In this application, intermediate data from the first model's inference task processing is obtained, along with the probability data upon which the first model derived the inference result, for subsequent analysis.
[0086] S204. Based on the probability data, determine the first probability corresponding to the reasoning result and the second probability corresponding to the target candidate result.
[0087] Specifically, the target candidate result is the candidate result whose probability in the probability data is only lower than the first probability. In other words, the inference result and the target candidate inference result are the first and second candidate results with the highest probabilities in the probability data.
[0088] For example, taking a classification task as an example, the probability data inferred by the first model can include the probability of each candidate category. Based on this probability data, the first model determines the candidate category with the highest probability as the inference result. Based on this, after obtaining this probability data, the probability of the second-ranked category can be determined according to the order of the probabilities in the probability data from high to low, thus obtaining the second probability corresponding to the target candidate result.
[0089] For other reasoning tasks, the probability data may include the probability corresponding to a word at at least one position. Based on this, this application can obtain the two highest probabilities corresponding to each position, wherein the highest probabilities at each position constitute the first probability corresponding to the reasoning result, and the second highest probabilities at each position constitute the second probability corresponding to the target candidate result.
[0090] S205, Based on the first probability, the difference between the first probability and the second probability, and the consistency information, determine the predicted probability distribution.
[0091] As mentioned earlier, the distribution parameters of this predicted probability distribution are used to characterize the likelihood that the inference task requires a target-oriented approach. This target-oriented approach has higher task inference capabilities than the first and second models.
[0092] If both the first probability and the second probability are single probability values, then the difference between the first probability and the second probability is a single value; if both the first probability and the second probability include probability values at multiple positions, then the difference between the first probability and the second probability is a combination of multiple probability differences or a matrix.
[0093] Understandably, compared to simply analyzing whether to use the target processing method for the inference task based solely on the first probability of the inference result, the difference between the first and second probabilities can characterize the reliability of the inference result as an accurate inference result. Furthermore, consistency information can also characterize whether the inference result can be determined as an accurate inference result. Therefore, by combining the first probability, the difference between the first and second probabilities, and this consistency information, it is possible to more accurately analyze whether to use the target processing method for the inference task. This allows the distribution parameters of the determined prediction probability distribution to more accurately characterize the probability that the target processing method should be used for the inference task. Naturally, it is possible to more rationally use the target processing method for the inference task. This can reduce the waste of resources caused by overusing the target processing method for the inference task, and also reduce the situation where the accuracy of the inference result is affected by not using the target processing method.
[0094] Furthermore, considering that the first model might be overconfident—that is, it might still give inference results with high confidence even when faced with uncertain or erroneous information—it could lead to misleading conclusions, causing the probabilities of many candidate results to be concentrated, which is not conducive to accurately determining the predicted probability distribution. Therefore, to improve the distinguishability between different candidate results, this application can also perform nonlinear transformations on the first and second probabilities respectively, obtaining transformed first and second probabilities. Correspondingly, the predicted probability distribution can be determined based on the transformed first probability, the difference between the transformed first and second probabilities, and this consistency information.
[0095] Specifically, for either the first probability or the second probability, the larger the absolute value of the difference between that probability and the target threshold, the larger the scaling ratio of that probability through the nonlinear transformation. In other words, the closer the probability is to the target threshold, the smaller the scaling ratio of that probability through the nonlinear transformation; conversely, the farther the probability is from the target threshold, the larger the scaling ratio of that probability through the nonlinear transformation. This target threshold can be set as needed; for example, the target threshold can be 0.5.
[0096] For example, taking a target threshold of 0.5 as an example, for any probability This application can perform a nonlinear transformation on the probability using the following formula to obtain the nonlinearly transformed probability. :
[0097]
[0098] in, This is a pre-defined scaling factor, and its value is a set value. According to the formula above, the closer the probability is to 0.5, the smaller the scaling ratio for that probability; the further the probability is from 0.5, the larger the scaling ratio for that probability.
[0099] S206, If it is determined from the predicted probability distribution that the target processing method needs to be adopted, the inference task is processed using the target processing method.
[0100] This step can be found in the previous introduction, and will not be repeated here.
[0101] In any of the above embodiments of this application, there can be multiple ways to determine the predicted probability distribution. In one possible implementation, this application can determine the predicted probability distribution using a Bayesian model based on the inference result and consistency information. For example, the predicted probability distribution can be determined using a Bayesian model based on the probability data corresponding to the inference result and the consistency information; or, the predicted probability distribution can be determined using a Bayesian model based on the first probability of the inference result, the difference between the first probability and the second probability of the target candidate result, and the consistency information.
[0102] The Bayesian model includes a parameter value matrix of at least one parameter, and the corresponding predicted probability distribution includes at least one predicted probability calculated based on the parameter value matrix of the at least one parameter. The parameter value matrix of the parameter includes at least one parameter value of that parameter.
[0103] For example, a Bayesian model may include: a probabilistic prediction function for calculating predicted probabilities, which includes at least one parameter with configurable values. The Bayesian model also includes parameter value matrices for each of these at least one parameter. The specific form of the probabilistic prediction function can be varied and is not limited thereto.
[0104] Based on this, each run of the Bayesian model can determine at least one set of parameter value combinations corresponding to the at least one parameter from the parameter value matrix corresponding to the at least one parameter. Each set of parameter value combinations includes one parameter value corresponding to each of the at least one parameter. Then, for each set of parameter value combinations, the parameter values of each parameter in the set are substituted into the probability prediction function, and combined with the inference result and consistency information, a prediction probability can be calculated. Accordingly, based on the at least one parameter value combination, at least one prediction probability can be determined, resulting in a prediction probability distribution composed of the at least one prediction probability.
[0105] For example, to facilitate understanding, let's take a linear regression function as the probability prediction function. Its formula can be expressed as y = Wx + b, where y represents the predicted probability and x is the input value, i.e., the inference result and consistency information. In practical applications, x is the feature vector transformed from the inference result and consistency information. Here, the weight coefficient W and the offset b in this linear regression function are two parameters whose values can be set. Specifically, the weight coefficient W and the offset b are not fixed scalars, but are modeled as random variables conforming to a specific probability distribution. For computational processing, this application discretizes the continuous probability spaces of W and b to transform them into parameter value matrices corresponding to W and b respectively. Each parameter value matrix includes multiple parameter values. For any parameter in W and b, each parameter value in the parameter value matrix represents a possible state of that parameter under that specific probability distribution. Based on this, the Bayesian model includes parameter value matrices corresponding to the weight coefficient W and the offset b respectively. Randomly selecting one parameter value of W and one parameter value of b from these two parameter value matrices can form a set of parameter value combinations. Correspondingly, after determining multiple combinations of parameter values, the parameter values of W and b in each combination can be substituted into the linear regression function to calculate a prediction probability; and multiple combinations of parameter values can naturally yield multiple prediction probabilities.
[0106] Understandably, compared to traditional machine learning models that can only output a conclusion on whether a target processing method is needed for a single representation, this application utilizes at least one predicted probability output by a Bayesian model to form a probability distribution estimate, i.e., a predicted probability distribution. The distribution parameters of this predicted probability distribution not only probabilistically characterize the likelihood of needing the target processing method but also the magnitude of the uncertainty in needing it, and possess a certain degree of interpretability. For example, the mean of the predicted probability distribution characterizes the probability that the target processing method is needed for the inference task, and the variance of the predicted probability distribution characterizes the uncertainty corresponding to the probability represented by the mean.
[0107] For ease of understanding, combined with Figure 3 Please provide an explanation. Figure 3 The diagram shows a comparison of the predicted probability distributions, mean, and variance of the predicted probability distributions for three different inference results determined using a Bayesian model.
[0108] For ease of understanding and description, in Figure 3 The example used is to determine the predicted probability distribution based on the first probability of the inference result, the difference between the first probability and the first probability of the target candidate result corresponding to the inference result, and the consistency information.
[0109] The consistency information corresponding to the reasoning result can be obtained by comparing whether the target reasoning result determined by the second model (i.e. the final output result of the speculative decoding process) is consistent with the reasoning result of the first model. If the target reasoning result is consistent with the reasoning result output by the first model, the consistency information can be represented as 1, that is, the reasoning result output by the first model is received by the second model; otherwise, the consistency information is 0.
[0110] exist Figure 3 Each row contains relevant data on the inference results obtained from a scenario, and the last column of each row is an example graph of the predicted probability distribution predicted by the Bayesian model.
[0111] Depend on Figure 3 As can be seen, the first scenario represents a high-confidence, low-uncertainty scenario. In this scenario, the first probability of the inference result output by the first model is relatively high, and the difference between the two highest probabilities (i.e., the first probability and the second probability) is relatively large. Furthermore, the consistency information is 1, meaning that the inference result of the first model is acceptable to the second model. Therefore, in this first scenario, the probability that the inference result inferred by the first model is accurate is relatively high.
[0112] Based on the first probability value in the first scenario, the difference between the first and second probabilities, and this consistency information, the predicted probability distribution determined using a Bayesian model is shown as the curve in the first row. It can be seen that the predicted probabilities are relatively concentrated in this distribution, and the curve is quite steep. The mean of this predicted probability distribution is 0.858, and the variance is... As can be seen, the mean of this predicted probability distribution is relatively large, while the variance is relatively small. The large mean indicates that the predicted probability distribution represents a higher probability that the inference result does not need to be processed using the target processing method, meaning that the likelihood of the inference result requiring the target processing method is relatively high. The small variance indicates that the uncertainty of not needing to process the inference result using the target processing method is relatively small.
[0113] In the second scenario, which presents low confidence and moderate uncertainty, the first probability of the inference outcome, as well as the difference between the first and second probabilities, are lower than the corresponding values in the first scenario. However, the first probability and the difference between them are still relatively high. Nevertheless, the consistency information is 0, meaning this inference outcome is not acceptable to the second model. Based on this, the mean of the predicted probability distribution determined using the Bayesian model is 0.580, and the variance is... The low mean and moderate variance of the predicted probability distribution indicate that the probability of not needing to use the target processing method to handle the inference result is low, while the probability of needing to use the target processing method to handle the inference result is high, and the uncertainty of needing to use the target processing method to handle the inference result is moderate.
[0114] Similarly, in the third scenario, which is characterized by low confidence and high uncertainty, the first probability and the difference between the first and second probabilities are relatively small, and the consistency information is 0, meaning the inference result is not acceptable to the second model. The mean of the predicted probability distribution determined using the Bayesian model is 0.534, and the variance is... The smaller mean and larger variance indicate that the reasoning result is more likely to be processed using a target-oriented approach, and the uncertainty of processing the reasoning result using a target-oriented approach is also relatively large.
[0115] Based on this, the distribution parameters of the predicted probability distribution output by the Bayesian model can reflect the possibility of whether the target processing method needs to be adopted and the uncertainty of this possibility. Thus, the distribution parameters of the predicted probability distribution can be used to comprehensively determine whether the target processing method needs to be adopted to process the reasoning task.
[0116] In this application, the Bayesian model can be obtained through training, and there are no restrictions on the specific implementation of the Bayesian model obtained through training.
[0117] In one possible implementation, the Bayesian model can be obtained by training and adjusting the parameter value matrix of each parameter based on the sample inference results and sample consistency information based on at least one sample inference task, combined with the sample decision results labeled by the sample inference task.
[0118] The sample inference result refers to the inference result of the sample inference task determined by the first model, and the sample inference task refers to the inference task used as the training sample. This sample consistency information is used to characterize whether the second model passes the verification of the sample inference result.
[0119] The sample decision result is used to characterize whether to use this target processing method to process the sample reasoning task. The sample decision result can be manually labeled or determined and labeled in other ways, without any specific restrictions.
[0120] For example, the parameter value matrix of each parameter can be trained and adjusted based on the first sample probability corresponding to the sample inference result of at least one sample inference task, the difference between the first sample probability and the second sample probability corresponding to the target sample candidate result, and the sample consistency information, combined with the sample decision results labeled by the sample inference task.
[0121] The target sample candidate result is a candidate sample whose probability is only lower than the first sample probability corresponding to the inference result in which the first model infers the sample inference result. The sample probability data includes the probability of at least one candidate sample result, and the inference result belongs to one of the at least one candidate sample result.
[0122] In particular, considering that the model performing the inference task may be overconfident, leading to a concentration of probabilities of candidate results for a large number of inference tasks in a high range (e.g., above 0.9), resulting in very small differences between these probabilities, the trained Bayesian model may suffer from poor robustness and low feature discrimination. Therefore, to broaden the interval between the probabilities corresponding to candidate results of different inference tasks and enhance the discriminability and robustness of feature samples, this application may first perform a nonlinear transformation on the first sample probability of each inference result and the second sample probability corresponding to the candidate result of the target sample.
[0123] The specific implementation of the nonlinear transformation of the first sample probability and the second sample probability can be found in the previous introduction, and will not be repeated here.
[0124] Accordingly, based on the nonlinearly transformed first sample probability, target sample probability difference, and sample consistency information corresponding to the sample inference results of the sample inference task, and combined with the sample decision results labeled in the sample inference task, the parameter value matrix of each parameter in the Bayesian model can be trained and adjusted to obtain the trained target Bayesian model. Specifically, for a sample inference task, the target sample probability difference is the difference between the nonlinearly transformed first sample probability and the nonlinearly transformed second sample probability.
[0125] To better understand the benefits of nonlinear transformation of sample probabilities, the following comparison illustrates this by examining the first sample probabilities of the inference results for each sample inference task before and after nonlinear transformation. For example... Figure 4 and Figure 5 .
[0126] in, Figure 4 An example plot of the distribution of the first sample probability of the sample inference results for multiple sample inference tasks is shown, where, Figure 4 The distribution diagram on the left is an example of the distribution of the first sample probability corresponding to the reasoning results of each sample with correct reasoning, while the distribution diagram on the right is an example of the distribution of the first sample probability corresponding to the reasoning results of each sample with incorrect reasoning.
[0127] exist Figure 4 and Figure 5 The horizontal axis represents the sample reasoning task number, while the vertical axis represents the sample probability.
[0128] Depend on Figure 4 As can be seen from the two distribution plots, the data of the inference results of samples with a first sample probability greater than 0.5 are relatively large, and the distribution of the first sample probability of each sample inference result is relatively concentrated, with relatively small differences in the first sample probability of different sample inference results.
[0129] Figure 5 This is an example diagram showing the distribution of the first sample probability after a nonlinear transformation of the inference results for multiple samples. Figure 5 The distribution plot on the left is an example of the first sample probability corresponding to the reasoning result of each sample with correct reasoning after non-transformation, while the distribution plot on the right is an example of the distribution of the first sample probability corresponding to the reasoning result of each sample with incorrect reasoning after non-linear transformation.
[0130] Depend on Figure 5 As can be seen from the two distribution plots, the difference between the probabilities of the first sample increases after the nonlinear transformation.
[0131] In this application, the specific process of training the Bayesian model can be conventional supervised training, and there are no restrictions on the specific training process.
[0132] In the above embodiments of this application, the target processing method is determined based on the predicted probability distribution. This can be determined based on one or more distribution parameters of the predicted probability distribution to process the inference result using the target processing method, without any specific limitation.
[0133] In one possible implementation, the target quantile value in the predicted probability distribution can be determined in this application. Accordingly, if the target quantile value is not less than a set threshold, it is determined that the inference task needs to be processed using a target processing method.
[0134] The target quantile can be set according to actual needs, and there are no restrictions on it.
[0135] For example, the mean of the predicted probability distribution represents the likelihood that the inference task needs to be processed using the target processing method; the variance of the predicted probability distribution represents the uncertainty corresponding to the likelihood represented by the mean. Based on this, the target fraction can represent what proportion of the inference results should be considered for processing using the target processing method.
[0136] In this application, the threshold setting can be based on actual needs or experience.
[0137] In one possible scenario, the threshold is determined based on a first factor and a second factor. The first factor represents the impact of erroneous inference results not being further processed using the target processing method on overall accuracy, while the second factor represents the impact of correct inference results still being further processed using the target processing method on efficiency.
[0138] To facilitate understanding of the process of determining the set threshold, the following example uses the determination of the prediction probability distribution through a Bayesian model to introduce the relationship between the set threshold and the first and second factors.
[0139] Assuming the first cost The first cost is the decrease in accuracy caused by the existence of erroneous inference results without further processing using the target processing method, while the second cost is... The cost of resources incurred when a correct reasoning result exists but further processing is still performed using the target processing method.
[0140] It is understandable that failing to further process incorrect inference results using the target processing method may lead to incorrect final inference results, and therefore is generally considered to be relatively costly; while further processing correct inference results using the target processing method will not affect the accuracy of inference, but will only lead to a decrease in efficiency, and therefore is generally considered to be relatively costly.
[0141] Assume the mean of the predicted probability distribution is Since the mean of the predicted probability distribution can characterize the likelihood that the reasoning task needs to be handled using the objective processing method, the probability of handling the reasoning task using the objective processing method can be expressed as: The probability of not using a goal-oriented approach to handle inference tasks can be expressed as: Based on this, the impact of failing to further process erroneous reasoning results using the target processing method can be expressed as: The impact of further processing correct inference results using the target processing method can be expressed as: .
[0142] We hope that the impact of not further processing incorrect reasoning results using the target processing method is less than the impact of further processing correct reasoning results using the target processing method. Therefore, this relationship can be expressed by the following formula:
[0143] (Formula 2);
[0144] In practical applications, only the cost ratio needs to be considered, not the specific numerical value. Therefore, it is assumed that... Substituting into Formula 2 above, we get Formula 3 as follows:
[0145] (Formula 3);
[0146] Furthermore, to measure the impact of uncertainty caused by the variance of the predicted probability distribution, the mean can be replaced with the quantiles of the predicted probability distribution. To measure uncertainty, we can obtain the following formula:
[0147] (Formula 4);
[0148] It is evident that whether a reasoning task requires further processing using a goal-oriented approach depends on the quantiles. and cost ratio It is determined by two parameters.
[0149] Regarding the cost ratio, since it is the ratio of the first cost to the second cost, if more emphasis is placed on reasoning accuracy, the cost ratio can be set relatively high. This means the cost of not processing incorrect reasoning results using the target processing method is higher, and based on Formula 4, a higher proportion of reasoning tasks will tend to use the target processing method. Conversely, if more emphasis is placed on efficiency, the cost ratio can be set relatively low. This means the cost of further processing correct reasoning results using the target processing method is higher, and based on Formula 4, the proportion of reasoning tasks requiring target processing can be controlled to be relatively small.
[0150] For quantiles, when the quantile value is high, it means that a minority of the sampled points in the predicted probability distribution are greater than the threshold on the right side of the greater than sign in Formula 4, and the standard for controlling the use of the target processing method is relatively lenient; when the quantile value is low, it means that most of the sampled points in the predicted probability distribution need to be greater than the threshold, and the standard for controlling the use of the target processing method is more stringent.
[0151] Therefore, this application can reasonably control the balance between inference accuracy and efficiency by controlling the quantile and the cost ratio. That is, by setting the quantile of the predicted probability distribution (i.e., the target quantile) and the set threshold affected by the cost ratio, the balance between accuracy and efficiency can be controlled.
[0152] To facilitate understanding of the scheme in this application, the following explanation uses a Bayesian model to determine the predicted quantiles, and illustrates one implementation method as an example. Figure 6 This illustrates another flowchart of the task reasoning control method provided in this application. The method in this embodiment may include:
[0153] S601, Based on the prompts for the reasoning task, determine the reasoning result of the reasoning task using the first model.
[0154] S602, obtain consistency information.
[0155] The consistency information indicates whether the second model passes the verification of the inference results. The parameter size of the second model is larger than that of the first model.
[0156] S603, obtain the probability data on which the inference result of the first model is based.
[0157] The probability data includes the probability of at least one candidate result inferred by the first model. The inference result inferred by the first model is one of the at least one candidate result.
[0158] S604. Based on the probability data, determine the first probability corresponding to the reasoning result and the second probability corresponding to the target candidate result.
[0159] The target candidate result is the candidate result whose probability is only lower than the first probability in the probability data.
[0160] S605, Based on the first probability, the difference between the first probability and the second probability, and the consistency information, a Bayesian model is used to determine the predicted probability distribution.
[0161] As mentioned earlier, the mean of the predicted probability distribution represents the likelihood of the reasoning task that needs to be handled using a target-oriented approach; the variance of the predicted probability distribution represents the uncertainty corresponding to the likelihood represented by the mean.
[0162] Of course, this application can also first perform nonlinear transformation on the first probability and the second probability respectively, and then use a Bayesian model to determine the predicted probability distribution based on the nonlinearly transformed first probability, the difference between the nonlinearly transformed first probability and the nonlinearly transformed second probability, and the consistency information.
[0163] S606, Determine the value of the target quantile in the predicted probability distribution.
[0164] For example, if the target quantile is a quartile, then it is necessary to determine the quartile of the predicted probability distribution and obtain the quartile value.
[0165] S607, If the value of the target quantile is not less than the set threshold, it is determined that the target processing method needs to be used to process the inference task.
[0166] To facilitate understanding of the advantages of using this embodiment, the following is combined with... Figure 7 To explain, Figure 7 The diagram shows a comparison of the proportion of erroneous inference results that can be handled by using the solution of this application versus using other solutions.
[0167] exist Figure 7 In the figure, the horizontal axis represents the proportion of inference tasks that need to be processed using the target processing method, which can be considered as a manifestation of quantiles; the vertical axis represents the proportion of erroneous inference results detected and processed by using the target processing method, which is simply referred to as the proportion of erroneous inference results captured.
[0168] contrast Figure 7 As can be seen from the curves, after adopting the scheme of this application, if the proportion of the reasoning task that needs to be processed by the target processing method is reasonably set, such as setting the proportion not less than 30%, then by comparing the curves of this scheme with the curves of other schemes, it can be seen that the scheme of this application can capture a higher proportion of erroneous reasoning results.
[0169] This application also provides an electronic device in its embodiments. For example... Figure 8 As shown, it illustrates a schematic diagram of the composition structure of the electronic device, which includes at least one processor 801 and at least one memory 802;
[0170] Memory 802 is used to store computer programs required for the processor to perform operations;
[0171] Processor 801 is configured to run the computer program to perform the following operations:
[0172] Based on the prompts for the reasoning task, the reasoning result of the reasoning task is determined using the first model;
[0173] Obtain consistency information, which indicates whether the second model passes the verification of the inference result, and the parameter size of the second model is larger than that of the first model;
[0174] Based on the inference results and consistency information, a predicted probability distribution is determined. The distribution parameters of the predicted probability distribution are used to characterize the probability that the inference task needs to be processed using a target processing method. The task inference capability of the target processing method is higher than that of the first model and the second model.
[0175] If the target processing method is determined to be required based on the predicted probability distribution, the inference task is processed using the target processing method.
[0176] For details on the specific operations performed by the processor, please refer to the relevant descriptions in the preceding embodiments, which will not be repeated here.
[0177] It is understood that the electronic device may also include a display unit 803 and an input unit 804, etc.
[0178] Of course, the electronic device can also have more than Figure 8 There are no restrictions on the number of components, whether more or fewer.
[0179] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the task reasoning control methods provided in this application.
[0180] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the task reasoning control methods provided in this application.
[0181] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0182] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0183] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0184] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A task reasoning control method, comprising: Based on the prompts for the reasoning task, the reasoning result of the reasoning task is determined using the first model; Obtain consistency information, which indicates whether the second model passes the verification of the inference result, and the parameter size of the second model is larger than that of the first model; Based on the inference results and consistency information, a prediction probability distribution is determined. The distribution parameters of the prediction probability distribution are used to characterize the probability that the inference task needs to be processed using a target processing method. The task inference capability of the target processing method is higher than that of the first model and the second model. If the target processing method is determined to be required based on the predicted probability distribution, the inference task is processed using the target processing method.
2. The task reasoning control method according to claim 1, wherein determining the prediction probability distribution based on the reasoning result and consistency information includes: Obtain the probability data on which the first model infers the inference result, the probability data including: the probability of at least one candidate result inferred by the first model, the inference result being one of the at least one candidate result; Based on the consistency information and the probability data, the predicted probability distribution is determined.
3. The task reasoning control method according to claim 2, wherein determining the prediction probability distribution based on the consistency information and the probability data includes: Based on the probability data, a first probability corresponding to the reasoning result and a second probability corresponding to the target candidate result are determined. The target candidate result is a candidate result whose probability is only lower than the first probability in the probability data. The predicted probability distribution is determined based on the first probability, the difference between the first probability and the second probability, and the consistency information.
4. The task reasoning control method according to claim 3, wherein determining the prediction probability distribution based on the first probability, the difference between the first probability and the second probability, and the consistency information includes: The first probability and the second probability are subjected to nonlinear transformation processing respectively to obtain the transformed first probability and the transformed second probability. For any one of the first probability and the second probability, the larger the absolute value of the difference between the probability and the target threshold, the larger the scaling ratio of the probability by the nonlinear transformation. The predicted probability distribution is determined based on the transformed first probability, the difference between the transformed first probability and the transformed second probability, and the consistency information.
5. The task reasoning control method according to claim 1, wherein determining the prediction probability distribution based on the reasoning result and consistency information includes: Based on the inference results and consistency information, a prediction probability distribution is determined using a Bayesian model. The Bayesian model includes a parameter value matrix of at least one parameter, and the prediction probability distribution includes at least one prediction probability calculated based on the parameter value matrix of at least one parameter.
6. The task reasoning control method according to claim 5, wherein the Bayesian model is obtained by training and adjusting the parameter value matrix based on the sample reasoning results and sample consistency information of at least one sample reasoning task, combined with the sample decision results labeled by the sample reasoning task; in, The sample consistency information is used to characterize whether the second model passes the verification of the sample inference result; the sample inference result is the inference result of the sample inference task determined by the first model; The sample decision result is used to characterize whether the target processing method is adopted to process the sample reasoning task.
7. The task reasoning control method according to claim 1, wherein determining the target processing method to be adopted based on the predicted probability distribution includes: Determine the value of the target quantile in the predicted probability distribution; If the value is not less than the set threshold, it is determined that the inference task needs to be processed using the target processing method.
8. The task reasoning control method according to claim 7, wherein the mean of the predicted probability distribution represents the probability that the reasoning task needs to be processed using a target processing method; and the variance of the predicted probability distribution represents the uncertainty corresponding to the probability represented by the mean.
9. The task reasoning control method according to claim 7 or 8, wherein the set threshold is determined based on a first factor and a second factor, the first factor representing the impact of an erroneous reasoning result without further processing using the target processing method on the overall accuracy, and the second factor representing the impact of a correct reasoning result but still requiring further processing using the target processing method on efficiency.
10. An electronic device, comprising: At least one processor and at least one memory; The memory is used to store the computer programs required for the processor to perform operations; The processor is configured to run the computer program to perform the following operations: Based on the prompts for the reasoning task, the reasoning result of the reasoning task is determined using the first model; Obtain consistency information, which indicates whether the second model passes the verification of the inference result, and the parameter size of the second model is larger than that of the first model; Based on the inference results and consistency information, a prediction probability distribution is determined. The distribution parameters of the prediction probability distribution are used to characterize the probability that the inference task needs to be processed using a target processing method. The task inference capability of the target processing method is higher than that of the first model and the second model. If the target processing method is determined to be required based on the predicted probability distribution, the inference task is processed using the target processing method.