A large model-based reasoning method, device and program product

By adopting the temperature coefficient decreasing strategy and screening rules in the large language model, the contradiction between diversity and accuracy is solved, processing efficiency is improved, and the accuracy and diversity of output are ensured.

CN119990339BActive Publication Date: 2025-08-08HUNDSUN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510473353.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-08-08
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

It is difficult for existing large language models to take into account both diversity and accuracy during the decoding process. The traditional method of temperature coefficient being constant leads to large calculation overhead and limited results.

Method used

The temperature coefficient decreasing strategy is adopted to gradually reduce the temperature coefficient during the generation of candidate sequences, thereby exploring diversity in the initial stage, gradually improving accuracy as the generation process advances, and the candidate sequence with low confidence is eliminated through screening rules to generate the final reply text.

Benefits of technology

It improves processing efficiency, reduces model overhead, and ensures the accuracy and diversity of outputs, and optimizes the reasoning ability of large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990339B_ABST
    Figure CN119990339B_ABST
Patent Text Reader

Abstract

This application proposes a large-scale model-based reasoning method, device, and program product. Using a single prompt word per request, without artificially constructing multiple prompt words, this method utilizes a decreasing temperature coefficient strategy to accompany the candidate sequence generation process, gradually shifting from diversity to precision for each word in each candidate sequence. Furthermore, when constructing the response text, candidate sequences with lower confidence are eliminated, while those with higher confidence are retained for response text generation. This improves processing efficiency, reduces model overhead, and ensures the accuracy of the final output response text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to, in particular, a large model-based reasoning method, device and program product. Background Art

[0002] In recent years, large language models (LLMs) have demonstrated powerful text generation and comprehension capabilities in natural language processing. To ensure diverse model outputs, temperature coefficients are often used during the decoding phase to control the smoothness of probability distributions. However, traditional temperature coefficients are typically constant during the text generation process of a single model call. A higher temperature coefficient can increase the randomness of the generated sequence, while a lower temperature coefficient can reduce randomness, making the output more deterministic and predictable.

[0003] However, the core contradiction of this decoding mechanism lies in the irreconcilable conflict between the need for diversity and the need for accuracy. On the one hand, while high-temperature sampling supports multi-path exploration, it is prone to factual errors or logical discontinuities. On the other hand, while low-temperature strategies improve local consistency, they inhibit the divergent thinking required for complex problems.

[0004] Therefore, to address these issues, existing technologies often use different prompt words to call the model multiple times to obtain different sequences, thereby increasing answer diversity. However, this approach significantly increases computational overhead and has limited improvement effects. Summary of the Invention

[0005] The purpose of this application is to provide a large-model-based reasoning method, device, and program product, which are used to take into account the diversity and accuracy of large-model answers while reducing large-model overhead.

[0006] In order to achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:

[0007] In a first aspect, an embodiment of the present application provides a large model-based reasoning method, including:

[0008] Based on the input prompt word, multiple candidate sequences are obtained; each candidate sequence has a corresponding sequence entropy value, and each sequence entropy value is used to characterize the diversity and accuracy of the corresponding candidate sequence; the sequence entropy value is composed of the word-gram entropy values of all word-grams in the corresponding candidate sequence; the word-gram entropy values of all word-grams in the same candidate sequence are generated sequentially based on a decreasing strategy of temperature coefficients;

[0009] Screening the plurality of candidate sequences according to a screening rule to obtain at least one target candidate sequence; wherein the screening rule is used to instruct to eliminate candidate sequences with low confidence among the plurality of candidate sequences;

[0010] Generate a reply text based on all the target candidate sequences.

[0011] Optionally, the step of obtaining multiple candidate sequences based on the input prompt word includes:

[0012] Based on the prompt word, at each generation moment, determining the word element corresponding to the generation moment according to the current temperature coefficient of each candidate sequence; wherein, corresponding to each generation moment, the value of the current temperature coefficient of the candidate sequence decreases successively according to the decreasing strategy;

[0013] According to the word units corresponding to all the generation moments, a corresponding candidate sequence is constructed.

[0014] Optionally, the screening rule is a screening range; the screening range is used to characterize the relative relationship between the confidence levels of the plurality of candidate sequences; the step of screening the plurality of candidate sequences according to the screening rule to obtain at least one target candidate sequence includes:

[0015] determining, based on the screening range, at least one candidate sequence to be eliminated from the plurality of candidate sequences; the candidate sequence to be eliminated being a candidate sequence with a relatively low confidence level among all candidate sequences;

[0016] All the eliminated candidate sequences are eliminated, and the remaining candidate sequences are used as the target candidate sequences.

[0017] Optionally, the step of generating a reply text based on all the target candidate sequences includes:

[0018] Determining whether the contents of all the target candidate sequences are identical;

[0019] If all are the same, generating a reply text according to the target candidate sequence;

[0020] If they are at least partially different, the at least two different target candidate sequences are screened, and a reply text is generated based on the screening result.

[0021] Optionally, the step of determining whether the contents of all the target candidate sequences are identical includes:

[0022] Determining the demand type corresponding to the prompt word;

[0023] If the requirement type is a result type, determining whether the contents of all the target candidate sequences are the same based on the results of all the target candidate sequences;

[0024] If the requirement type is non-result type, a content identification module is called to identify all the target candidate sequences to obtain the contents of all the target candidate sequences; and it is determined whether the contents of all the target candidate sequences are the same.

[0025] In a second aspect, an embodiment of the present application provides an inference device based on a large model, comprising: a generation module, a screening module, and an output module;

[0026] The generation module is configured to obtain a plurality of candidate sequences based on an input prompt word; each candidate sequence has a corresponding sequence entropy value, each sequence entropy value being used to characterize the diversity and accuracy of the corresponding candidate sequence; the sequence entropy value is composed of the word-gram entropy values of all word-grams in the corresponding candidate sequence; the word-gram entropy values of all word-grams in the same candidate sequence are generated sequentially based on a decreasing temperature coefficient strategy;

[0027] The screening module is configured to screen the plurality of candidate sequences according to a screening rule to obtain at least one target candidate sequence; the screening rule is configured to instruct to eliminate candidate sequences with low confidence from the plurality of candidate sequences;

[0028] The output module is used to generate a reply text based on all the target candidate sequences.

[0029] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0030] a memory for storing one or more programs;

[0031] processor;

[0032] When the one or more programs are executed by the processor, the method as described in any one of the above-mentioned first aspects is implemented.

[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of the above-mentioned first aspects.

[0034] In a fifth aspect, an embodiment of the present application provides a program product, which, when executed by a processor, implements the method as described in any one of the above-mentioned first aspects.

[0035] Compared to the prior art, the large-model-based reasoning method, device, and program product provided in the embodiments of the present application utilize a temperature coefficient reduction strategy to accompany the candidate sequence generation process, using one prompt word per request without artificially constructing multiple prompt words. This allows each word in each candidate sequence to gradually transition from pursuing diversity to pursuing accuracy. Furthermore, when constructing the reply text, candidate sequences with lower confidence levels are eliminated, and candidate sequences with higher confidence levels are retained for reply text generation. This improves processing efficiency, reduces model overhead, and ensures the accuracy of the final output reply text.

[0036] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 A schematic diagram of the self-optimization architecture of existing technologies;

[0039] Figure 2 A schematic diagram of a self-optimization architecture provided by an embodiment of the present invention

[0040] Figure 3 A flowchart of a large model-based reasoning method provided by an embodiment of the present invention;

[0041] Figure 4 A flowchart of another large model-based reasoning method provided by an embodiment of the present invention;

[0042] Figure 5 A schematic diagram of another self-optimization architecture provided by an embodiment of the present invention;

[0043] Figure 6 Schematic diagram of temperature coefficient distribution based on the drop amplitude;

[0044] Figure 7 It is a schematic diagram of the distribution of sequence entropy values under dynamic temperature coefficient;

[0045] Figure 8 A flowchart of another large model-based reasoning method provided by an embodiment of the present invention;

[0046] Figure 9A schematic diagram of another self-optimization architecture provided by an embodiment of the present invention;

[0047] Figure 10 A schematic diagram of a self-optimization process of the prior art;

[0048] Figure 11 A flowchart of another large model-based reasoning method provided by an embodiment of the present invention;

[0049] Figure 12 A schematic diagram of another self-optimization architecture provided by an embodiment of the present invention;

[0050] Figure 13 A schematic diagram comparing the results of the temperature coefficient reduction strategy of this application with other methods using a static temperature coefficient;

[0051] Figure 14 This is a diagram comparing the number of calls and token consumption of this application solution and other methods on a large model;

[0052] Figure 15 A schematic diagram of an inference device provided by an embodiment of the present invention;

[0053] Figure 16 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.

[0055] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in the present application without creative work are within the scope of protection of the present application.

[0056] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and should not be understood as indicating or implying relative importance.

[0057] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0058] In recent years, large language models (LLMs) have made significant progress in natural language processing (NLP), but they still face numerous challenges in complex reasoning tasks. To improve the reasoning capabilities of large models, researchers have proposed various approaches, including Chain of Thought (CoT), reinforcement learning (RL), and self-optimization. These approaches, from different perspectives, optimize the model's internal consistency and reasoning process, reduce the generation of hallucinatory content, and improve the model's performance on multi-step reasoning tasks.

[0059] The core idea of thought chaining is to guide a large language model by presenting it with a small number of reasoning examples, guiding it to demonstrate its reasoning process when answering questions. This approach breaks down complex problems into multiple intermediate steps, enabling the model to approach them more systematically. For example, when solving math problems, CoT helps the model better understand and generate reasoning by demonstrating the steps involved. CoT not only improves the model's reasoning accuracy but also enables it to handle more complex tasks, such as commonsense reasoning and symbolic reasoning.

[0060] Reinforcement learning significantly expands the reasoning capabilities of large language models by automatically generating high-quality reasoning trajectories through a trial-and-error search algorithm. During training, the model receives reward signals to optimize its reasoning strategy. This approach not only improves the model's reasoning accuracy but also enables deeper thinking during testing.

[0061] The core goal of self-optimization is to improve the performance and reasoning capabilities of the model through internal mechanisms. Self-optimization emphasizes that the model achieves better results through self-feedback, self-adjustment, and self-improvement. For example, the self-consistency method improves the model's reasoning ability by generating multiple reasoning paths and selecting the most consistent answer. The self-refine method improves the model's accuracy by gradually optimizing its reasoning process. After generating the reasoning path, the model adjusts based on feedback from the intermediate steps to produce more accurate results. Self-contrast identifies and corrects model errors by comparing the results of different reasoning paths. This method is similar to the "comparative analysis" used by humans when solving problems, discovering potential problems by comparing the results of different methods.

[0062] Alternatively, existing large-model decoding strategies often fall into the problem of balancing diversity and accuracy. Usually, during the text generation process, the temperature coefficient is used to control the smoothness of the probability distribution, indirectly controlling the certainty of the generated results. The following uses self-optimization as an example to illustrate the existing decoding strategy. Specifically, Figure 1 For a schematic diagram of the self-optimization architecture of the existing technology, see Figure 1 , which shows that in the prior art, when a user inputs a request (which may be in the form of a prompt) to a large model, the large model can construct each token in each candidate sequence (candidate) based on a specific temperature coefficient. Figure 1 The candidate sequences shown are candidate sequence 1, ..., candidate sequence i, ..., candidate sequence n, etc. Then, the multiple candidate sequences are screened through a screening mechanism to obtain a final reply text.

[0063] As can be seen, tokens, as the basic units of text generation (such as words or subwords), are the foundation of the generation process. The model generates a probability distribution for the next token by analyzing the context. The temperature coefficient acts like a "tuning knob": a high temperature (e.g., T > 1) makes the probability distribution of tokens more uniform, increasing the likelihood of low-probability tokens, thereby increasing the entropy (uncertainty) of the distribution and making the model more inclined to generate diverse and even creative text. A low temperature (e.g., T < 1) strengthens the advantages of high-probability tokens, reduces entropy, and makes the output more conservative and stable. Finally, based on the adjusted probability distribution, the model uses a sampling strategy to piece together a complete text sequence token by token, such as the candidate sequence above.

[0064] For example, high temperatures might generate novel metaphors like "the sunset glow burns like flames," while low temperatures are more likely to generate conventional expressions like "the weather is fine this evening." Therefore, the temperature coefficient, by regulating the magnitude of entropy, becomes the core hub for balancing the "creativity" and "reliability" of text sequences. The choice of lemmas in this dynamic process determines the specific form of the generated content.

[0065] However, in the process of constructing each candidate sequence, the prior art often uses the traditional temperature coefficient T to construct each token in the candidate sequence. In this process, the traditional temperature coefficient T is a constant. Figure 1 ,Should Figure 1 The probability distribution of response tokens is shown, with the vertical axis representing the token's probability value and the horizontal axis representing the text length of the candidate sequence. The inventors discovered that this mechanism means that during the entire candidate sequence generation process, since each token in the candidate sequence is based on the same temperature coefficient, when T is high, the entire candidate sequence tends to be more "random." On the other hand, when T is low, the entire candidate sequence tends to be more "conservative."

[0066] Based on the above-mentioned problem of balancing diversity and accuracy in the prior art, the present application provides a mechanism for dynamically adjusting the temperature coefficient. The core idea is that when constructing any candidate sequence, the corresponding temperature coefficient is systematically controlled to decrease from high to low, so that in the initial stage of candidate sequence construction, a wider range of potential outputs of word units are explored based on higher temperature coefficients. Then, as the candidate sequence generation process progresses and the text length increases, the temperature coefficient is systematically reduced to enhance the coherence and accuracy of the corresponding candidate sequence text in the reasoning logic. This adaptive temperature control enables the model to explore diverse outputs in the initial stage, and focus on more accurate reasoning as the text generation unfolds, thereby optimizing the overall performance.

[0067] Specifically, Figure 2 A schematic diagram of a self-optimization architecture provided by an embodiment of the present invention, see Figure 2 , as described above, the mechanism for dynamically adjusting the temperature coefficient determines the initial word-units when constructing candidate sequences based on a higher temperature coefficient. This results in a higher degree of randomness in the early word-units of each candidate sequence generation phase. As the candidate sequence construction process progresses, the temperature coefficient values of subsequent word-units decrease based on the decreasing temperature coefficient strategy. As previously mentioned, as the temperature coefficient decreases, the model tends to generate more coherent and less random word-units. Based on this approach, as the temperature coefficient of each word-unit decreases during the candidate sequence generation process, the text gradually transitions from randomness to coherence.

[0068] From the perspective of the temperature coefficient as a method for regulating entropy, the technical solution of this application can be found to be able to gradually reduce the entropy of the candidate sequence, i.e., reduce uncertainty, by systematically reducing the temperature coefficient during the construction of the candidate sequence. Figure 2 The "response word probability distribution" is constructed as the construction process progresses, that is, as the length of the text increases, the randomness of the corresponding word is also reduced, thus taking into account the randomness and certainty of the text corresponding to the candidate sequence. The following is an example of the reasoning method based on the large model, combined with the temperature coefficient reduction strategy proposed in this application. Specifically, Figure 3 A flow chart of a large model-based reasoning method provided by an embodiment of the present invention is shown in FIG. Figure 3 , the method comprising:

[0069] Step 100: Based on the input prompt word, obtain multiple candidate sequences.

[0070] Among them, such as Figure 2 As shown, each candidate sequence has a corresponding sequence entropy value, and each sequence entropy value is used to characterize the diversity and accuracy of the corresponding candidate sequence; the sequence entropy value is composed of the word-gram entropy values of all words in the corresponding candidate sequence; the word-gram entropy values of all words in the same candidate sequence are generated sequentially based on the decreasing strategy of the temperature coefficient.

[0071] Specifically, there are various ways to construct the sequence entropy value from the word-gram entropies of all word-grams in the candidate sequence. For example, the sequence entropy value may be the sum of the word-gram entropies of all word-grams during the generation of the candidate sequence; or the sequence entropy value may be the average of the word-gram entropies of all word-grams during the generation of the candidate sequence.

[0072] It should be noted that the generation of each word in each candidate sequence is based on a decreasing temperature coefficient. Therefore, the entropy of each word decreases as the corresponding temperature coefficient decreases. This makes the final candidate sequence entropy more balanced than the entropy obtained by using a constant temperature coefficient in existing technologies, balancing diversity and accuracy.

[0073] Step 101: Screen multiple candidate sequences according to screening rules to obtain at least one target candidate sequence.

[0074] The screening rule is used to indicate that candidate sequences with low confidence levels are eliminated from multiple candidate sequences.

[0075] It should be noted that due to the higher temperature coefficient, the word-units it forms have higher word-unit entropy values and lower confidence. Therefore, since the sequence entropy value is composed of the entropy values of all corresponding word-units, this means that in one possible implementation, among multiple candidate sequences, candidate sequences with higher entropy values, i.e., lower confidence values, can be eliminated based on different sequence entropy values.

[0076] Step 102: Generate a reply text based on all target candidate sequences.

[0077] The large-model inference method provided by the present invention uses a single prompt word per request, without artificially constructing multiple prompt words. This method utilizes a decreasing temperature coefficient strategy to accompany the candidate sequence generation process, gradually shifting the focus from diversity to precision for each word in each candidate sequence. Furthermore, when constructing the response text, candidate sequences with lower confidence levels are eliminated, while those with higher confidence levels are retained for response text generation. This improves processing efficiency, reduces model overhead, and ensures the accuracy of the final output response text.

[0078] Optionally, a possible implementation method is provided below for step 100. Specifically, Figure 3 On the basis of Figure 4 A flow chart of another large model-based reasoning method provided by an embodiment of the present invention is shown in FIG. Figure 4 , step 100, comprising:

[0079] Step 100 - 1 : At each generation moment, determine the word element corresponding to the generation moment according to the current temperature coefficient of each candidate sequence.

[0080] Among them, corresponding to each generation moment, the value of the current temperature coefficient of the candidate sequence decreases successively according to the decreasing strategy.

[0081] Step 100 - 2 : Construct a corresponding candidate sequence based on the word units corresponding to all generation moments.

[0082] It should be noted that, for different candidate sequences in the word unit generation process, at the same generation time, the corresponding current temperature coefficients can be the same or different. This is not limited here. Optional, Figure 5 A schematic diagram of another self-optimization architecture provided by an embodiment of the present invention shows the relationship between candidate sequences, word units, temperature coefficients, word unit entropy values, sequence entropy values, and generation time.

[0083] For details, see Figure 5For a certain generation time, for example, generation time 1, its temperature coefficient is T1, and then based on T1, the word unit 1 of each candidate sequence is generated. Then the word unit entropy value 1 corresponding to the word unit 1 is obtained.

[0084] It should be noted that since each candidate sequence is random in selecting word 1, the word entropy value 1 of word 1 in different candidate sequences may be different, and thus the sequence entropy value of each candidate sequence may also be different.

[0085] Then, as the candidate sequence generation progresses, for example, for the generation time i, its corresponding temperature coefficient T i It should be smaller than T1 mentioned above.

[0086] Below, a temperature coefficient T is provided. t Possible expressions for :

[0087]

[0088] in represents the temperature coefficient corresponding to the t-th generation moment, represents the initial temperature coefficient, e.g. Figure 5 T1 shown; Represents the target temperature coefficient, which represents the temperature with high accuracy; Represents the rate of decrease. The higher it is, the slower the function decreases. This expression converts the temperature coefficient into an exponential function that is related to the length of the output text.

[0089] therefore, Figure 6 For a schematic diagram of the temperature coefficient distribution based on the drop amplitude, see Figure 6 The vertical axis is the temperature coefficient value, and the horizontal axis is the text length. It shows the relationship between the dynamic temperature coefficient and the sequence entropy, text length, and decline rate. Red indicates a higher temperature coefficient value, and blue indicates a lower temperature coefficient value.

[0090] Among them, in the prior art, a constant temperature coefficient, such as T=0.8, T=0.2, is Figure 6 The entropy value in is a horizontal straight line.

[0091] Due to the decrease of the temperature coefficient of the present application, the sequence entropy value of the candidate sequence is also showing a decreasing trend. Therefore, the decreasing strategy of the temperature coefficient of the present application, combined with the screening of candidate sequences based on the sequence entropy value, can be understood as a kind of entropy decay incentive sampling (EDIS). Furthermore, for the change curve of the temperature coefficient using the present application solution (EDIS), the decline range of the curve is different based on different decline rates, such as Figure 6 As shown in , as well as , the corresponding entropy value decreases at different rates as the text length increases.

[0092] Optionally, Figure 7 This is a schematic diagram of the distribution of sequence entropy values under dynamic temperature coefficient, see Figure 7 , where the vertical axis is the average entropy of the sequence entropy and the horizontal axis is the text length. This shows that as the reasoning process progresses, the temperature coefficient in this scheme systematically decreases, and the sequence entropy distribution of different candidate sequences at different text lengths.

[0093] Optionally, the relationship between the sequence entropy value and the temperature coefficient is expressed as follows:

[0094]

[0095] in, is the sequence entropy value of the candidate sequence at the generation time t. T is the temperature coefficient corresponding to the generation time t. is the number of words. For the The raw probability of the word output. For the The probability of a word after controlling the temperature coefficient T.

[0096] Optionally, after constructing multiple candidate sequences in this solution, how to perform screening. This application also provides a possible implementation method. First, the screening rules mentioned above can be a screening range. The screening range is used to characterize the relative relationship between the confidence levels of multiple candidate sequences. The following is an exemplary introduction based on the screening range. Specifically, Figure 3 On the basis of Figure 8 A flow chart of another large model-based reasoning method provided by an embodiment of the present invention is shown in FIG. Figure 8 , step 101, comprising:

[0097] Step 101 - 1 : Determine at least one candidate sequence to be eliminated from a plurality of candidate sequences according to a screening range.

[0098] Among them, the eliminated candidate sequences are candidate sequences with relatively low confidence among all candidate sequences.

[0099] Step 101 - 2 : Eliminate all candidate sequences and use the remaining candidate sequences as target candidate sequences.

[0100] Optionally, the screening range may be implemented based on the sequence entropy value of each candidate sequence. For example, when there are four candidate sequences, the two candidate sequences with the highest sequence entropy values are eliminated as candidate sequences.

[0101] The following uses the Llama series (2-7B-chat, 2-13B-chat, 3.2-3B-Instruct, and 3.1-8B-Instruct) models to illustrate the accuracy performance of different screening ranges. See Table 1 for details.

[0102]

[0103] The "number-number" in the screening range means: if there are 3 candidate sequences, keep 3 candidate sequences as target candidate sequences; if there are 4 candidate sequences, keep 2 candidate sequences as target candidate sequences; and so on. The bold values are used to highlight the best performing data in each column.

[0104] It can be found that in each model version of the current test example, the screening range is: 4 candidate sequences screen 3 target candidate sequences, that is, the candidate sequence with the highest sequence entropy value is eliminated, and its average performance index is the best.

[0105] Optional, in Figure 5 On the basis of Figure 9 A schematic diagram of another self-optimization architecture provided by an embodiment of the present invention shows how to implement screening after constructing multiple candidate sequences.

[0106] Specifically, in this example, if N candidate sequences are screened, the candidate sequence with the highest sequence entropy value is eliminated. Figure 9 For example, if 1 to N candidate sequences are constructed, and based on the entropy values of each sequence, it is determined that candidate sequence 3 has the highest entropy value, then candidate sequence 3 can be considered the candidate sequence with the lowest confidence. Therefore, it is eliminated, and the remaining candidate sequences are used as the target candidate sequences.

[0107] Of course, if the screening range includes N candidate sequences and the first M candidate sequences with the highest entropy values are eliminated, the processing mechanism is similar and will not be described in detail here.

[0108] Optionally, after obtaining all target candidate sequences, that is, completing the reasoning path, errors in the target candidate sequences constructed by the large model can also be identified and corrected, thereby improving the accuracy of the reply text.

[0109] In order to identify and correct the above errors, the existing technology uses the logic of artificially constructing multiple different prompt words for a request, and then using these prompt words to self-optimize the reply text. Specifically, Figure 10 A self-optimization process diagram of the prior art. Figure 10 In this process, we first manually construct 1 to N prompt words for a request, and then use the model to generate responses corresponding to each prompt word. The large model then compares these prompt words pairwise, generating N(N-1) / 2 comparison results. Based on these comparison results, the large model summarizes them into a checklist, and finally uses the checklist to correct the response.

[0110] The aforementioned existing methods aim to address the stubbornness and overconfidence of large models through comparative analysis. However, these methods incur significant computational overhead, offer limited improvement, and are still plagued by the stubbornness of large models during the final generation phase. Furthermore, for large, less powerful models, the complex processes and prompts are not only ineffective but can even have negative consequences. This process is highly complex and redundant.

[0111] Therefore, this application provides a simplified self-contrast process to solve the above problems. Figure 3 On the basis of Figure 11 A flow chart of another large model-based reasoning method provided by an embodiment of the present invention is shown in FIG. Figure 11 , step 102, comprising:

[0112] Step 102-1: Determine whether the contents of all target candidate sequences are the same.

[0113] Specifically, if all are the same, execute step 102-2; if at least part of them are different, execute step 102-3.

[0114] Step 102-2: Generate a reply text based on the target candidate sequence.

[0115] Step 102-3: Screen at least two different target candidate sequences, and generate a reply text based on the screening results.

[0116] For ease of explanation Figure 11 The role of the process in this application scheme is Figure 9 On the basis of Figure 12 Another self-optimization architecture diagram provided by an embodiment of the present invention shows how to implement a simplified self-optimization process after determining a target candidate sequence.

[0117] First, as mentioned above, this solution eliminates the need to manually construct multiple different prompt words to obtain multiple responses to a single request. Instead, it utilizes the dynamic decrement mechanism of the temperature coefficient described above to construct multiple target candidate sequences. This improves efficiency while reducing the overhead of repeatedly calling the model.

[0118] The model then determines whether all target candidate sequences have the same content, thereby triggering all the same processing flows and at least some of the different processing flows.

[0119] For some different processing procedures, this application only screens the target candidate sequences with differences to obtain the corrected reply text.

[0120] The optimization mechanism of this application eliminates the need to compare multiple reply texts in pairs and then construct a checklist to make corrections, effectively simplifying the self-optimization process.

[0121] In the above process, there are different types of requirements for requests or prompt words. For example, when calculating a data formula during a request, the requirement for the reply text is clear and belongs to the result type. When the request itself is an open-ended question, the reply texts corresponding to the multiple target candidate sequences may differ in literal meaning, but they may be the same in semantics. Therefore, these two types of requirements can be handled differently to further improve recognition accuracy. Therefore, a possible implementation of step 102-1 above is:

[0122] Determine the requirement type corresponding to the prompt word.

[0123] If the requirement type is a result class, then based on the results of all target candidate sequences, it is determined whether the contents of all target candidate sequences are the same.

[0124] If the requirement type is non-result type, the content identification module is called to identify all target candidate sequences, obtain the content of all target candidate sequences, and then determine whether the content of all target candidate sequences is the same.

[0125] Optionally, the content recognition module can be a third-party semantic recognition tool or semantic model. The content recognition module can effectively identify the semantic information of all target candidate sequences, and then determine whether they are identical based on the content of the semantic information to improve the accuracy of the determination.

[0126] Optionally, for the above example, the effectiveness of the method of this application was verified on the Llama series (2-7B-chat, 2-13B-chat, 3.2-3B-Instruct, 3.1-8B-Instruct) and the Qwen2.5 series (3B-Instruct, 7B-Instruct, 14B-Instruct), based on the GSM8K, SVAMP, and MATH datasets. The performance comparison of the method of this application with other methods [Base CoT, Self-Contrast, Self-Refine, and Self-Consistency] is shown in Table 2:

[0127] Table 2 Comparison of this application method with other methods

[0128]

[0129] As shown in Table 1, the method of this application has greatly improved the existing methods in various models.

[0130] Optionally, Figure 13 For a comparison of the results of this application's temperature coefficient reduction strategy and other methods using a static temperature coefficient, see Figure 13 , using the GSM8K dataset as test data, the results of comparing our solution (ours) with the basic chain of thought (Base CoT) and self-consistency (Self-Consistency).

[0131] Specifically, Figure 13 The experimental data comparison based on the basic thinking chain, self-consistency and this scheme is presented for Llama-2-7B, Llama-2-13B, Llama-3.2-3B and Llama-3.1-8B in the LLM model.

[0132] Here, "Ours (T=0.7)" refers to the data effect corresponding to the temperature coefficient being constant at 0.7 and using the filtering mechanism in the above example of this solution.

[0133] “Ours (EDIS)” refers to the data results obtained by using the dynamic reduction strategy of the temperature coefficient in the above example and the filtering mechanism in the above example of this solution.

[0134] “SC(T=0.7)” means that the temperature coefficient is kept constant at 0.7, and subsequent processing is performed using the original self-consistency technology solution.

[0135] “SC(EDIS)” refers to the use of the dynamic reduction strategy of the above-mentioned example temperature coefficient, and then the subsequent processing using the original technical solution of self-consistency.

[0136] “Base CoT (T=0.7)” means: the temperature coefficient is constant at 0.7, and subsequent processing is performed using the original technical solution of the Basic Thinking Chain (BaseCoT).

[0137] “Base CoT (EDIS)” refers to the use of the dynamic reduction strategy of the above-mentioned example temperature coefficient, and then the subsequent processing using the original technical solution of the Basic Chain of Thinking (Base CoT).

[0138] Visible for Figure 13 The model shown can bring further optimization effects for the dynamic reduction strategy of the temperature coefficient and the optimized screening mechanism shown in the above example of this solution, whether it is fully adopted or only partially adopted.

[0139] Optionally, Figure 14 This is a comparison diagram of the number of times this application solution and other methods are called on a large model and the consumption of tokens. Figure 14 Based on the LLM model, with GSM8K and MATH as test data, this application (ours) is compared with self-optimization (Self-Contrast), self-improvement (Self-Refine) and self-consistency (Self-Consistency) from the average number of model calls (Call Times Avg) and the average token consumption (Tokens Avg). It can be found that this application is at a lower level in terms of model call times (Call Times) and token consumption.

[0140] Alternatively, Table 3 below provides an accuracy comparison based on GSM8K for the filtering mechanism in the above example. Compare & Checklist & Revision (C&C&R) is derived from Self-Contrast and is a unified selection using the LLM after pairwise comparison. Choose generates only one selection, while Entropy selects based solely on entropy.

[0141]

[0142] It can be seen that the screening mechanism of the present application has a higher overall accuracy rate than other methods in the prior art.

[0143] Based on the reasoning method provided in the above examples, a large model-based reasoning device is provided below to implement the steps of each of the above methods, thereby achieving the corresponding technical effects.

[0144] Specifically, Figure 15 A schematic diagram of an inference device provided by an embodiment of the present invention is shown in FIG. Figure 15 The device 20 includes: a generating module 200, a screening module 201 and an output module 202.

[0145] The generation module 200 is used to obtain multiple candidate sequences based on the input prompt word.

[0146] The screening module 201 is configured to screen multiple candidate sequences according to screening rules to obtain at least one target candidate sequence.

[0147] The output module 202 is used to generate a reply text based on all target candidate sequences.

[0148] Optionally, the generation module 200 is specifically configured to: based on the prompt word, determine the word element corresponding to each generation moment according to the current temperature coefficient of each candidate sequence at each generation moment; and construct the corresponding candidate sequence according to the word elements corresponding to all generation moments.

[0149] Optionally, the screening module 201 is specifically configured to: determine at least one elimination candidate sequence from multiple candidate sequences according to a screening range; the eliminated candidate sequence is a candidate sequence with relatively low confidence among all candidate sequences; eliminate all eliminated candidate sequences and use the remaining candidate sequences as target candidate sequences.

[0150] Optionally, the output module 202 is specifically used to: determine whether the contents of all target candidate sequences are the same; if they are all the same, generate a reply text based on the target candidate sequence; if they are at least partially different, screen at least two different target candidate sequences, and generate a reply text based on the screening results.

[0151] Optionally, the output module 202 is further specifically used to: determine the requirement type corresponding to the prompt word; if the requirement type is a result type, then based on the results of all target candidate sequences, determine whether the contents of all target candidate sequences are the same; if the requirement type is a non-result type, then call the content recognition module to identify all target candidate sequences to obtain the contents of all target candidate sequences; and determine whether the contents of all target candidate sequences are the same.

[0152] The embodiment of the invention further provides an electronic device that can execute all the steps of the above examples of the embodiment of the invention to achieve the corresponding technical effects. Specifically, Figure 16 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, see Figure 16, the electronic device 30 , comprises: a memory 301 , a processor 300 ;

[0153] Memory 301, used to store one or more programs;

[0154] Processor 300;

[0155] When one or more programs are executed by the processor, when the electronic device 30 is used to perform the steps shown in the above-mentioned method examples, it can achieve each step and corresponding technical effects.

[0156] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.

[0157] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0158] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a program product. The program product is stored in a computer-readable storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.

[0159] The above are merely preferred embodiments of the present application and are not intended to limit the present application. Those skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

[0160] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present application is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

Claims

1. A large model-based reasoning method, characterized in that: include: Based on the input prompt word, multiple candidate sequences are obtained; Each candidate sequence has a corresponding sequence entropy value, and each sequence entropy value is used to characterize the diversity and accuracy of the corresponding candidate sequence; the sequence entropy value is composed of the word-gram entropy values of all words in the corresponding candidate sequence; the word-gram entropy values of all words in the same candidate sequence are generated sequentially based on a decreasing strategy of temperature coefficients; Screening the plurality of candidate sequences according to a screening rule to obtain at least one target candidate sequence; wherein the screening rule is used to instruct to eliminate candidate sequences with low confidence among the plurality of candidate sequences; Generate a reply text based on all the target candidate sequences.

2. The method according to claim 1, characterized in that The step of obtaining multiple candidate sequences based on the input prompt word includes: Based on the prompt word, at each generation moment, determining the word element corresponding to the generation moment according to the current temperature coefficient of each candidate sequence; wherein, corresponding to each generation moment, the value of the current temperature coefficient of the candidate sequence decreases successively according to the decreasing strategy; According to the word units corresponding to all the generation moments, a corresponding candidate sequence is constructed.

3. The method according to claim 1, characterized in that The screening rule is a screening range; the screening range is used to characterize the relative relationship between the confidence levels of the plurality of candidate sequences; The step of screening the plurality of candidate sequences according to the screening rules to obtain at least one target candidate sequence includes: determining, based on the screening range, at least one candidate sequence to be eliminated from the plurality of candidate sequences; the candidate sequence to be eliminated being a candidate sequence with a relatively low confidence level among all candidate sequences; All the eliminated candidate sequences are eliminated, and the remaining candidate sequences are used as the target candidate sequences.

4. The method according to claim 1, wherein The step of generating a reply text based on all the target candidate sequences includes: Determining whether the contents of all the target candidate sequences are identical; If all are the same, generating a reply text according to the target candidate sequence; If they are at least partially different, the at least two different target candidate sequences are screened, and a reply text is generated based on the screening result.

5. The method according to claim 4, characterized in that The step of determining whether the contents of all the target candidate sequences are identical comprises: Determine the demand type corresponding to the prompt word; If the requirement type is a result type, determining whether the contents of all the target candidate sequences are the same based on the results of all the target candidate sequences; If the requirement type is non-result type, a content identification module is called to identify all the target candidate sequences to obtain the contents of all the target candidate sequences; and it is determined whether the contents of all the target candidate sequences are the same.

6. A large model-based reasoning device, characterized in that: include: Generation module, screening module and output module; The generation module is used to obtain multiple candidate sequences based on the input prompt word; Each candidate sequence has a corresponding sequence entropy value, and each sequence entropy value is used to characterize the diversity and accuracy of the corresponding candidate sequence; the sequence entropy value is composed of the word-gram entropy values of all words in the corresponding candidate sequence; the word-gram entropy values of all words in the same candidate sequence are generated sequentially based on a decreasing strategy of temperature coefficients; The screening module is configured to screen the plurality of candidate sequences according to a screening rule to obtain at least one target candidate sequence; the screening rule is configured to instruct to eliminate candidate sequences with low confidence among the plurality of candidate sequences; The output module is used to generate a reply text based on all the target candidate sequences.

7. The device according to claim 6, characterized in that The generation module is specifically configured to: based on the prompt word, determine, at each generation moment, the word element corresponding to the generation moment according to the current temperature coefficient of each candidate sequence; wherein, corresponding to each generation moment, the value of the current temperature coefficient of the candidate sequence decreases successively according to the decreasing strategy; and construct a corresponding candidate sequence based on the word elements corresponding to all the generation moments.

8. An electronic device, characterized in that: include: a memory for storing one or more programs; processor; When the one or more programs are executed by the processor, the method according to any one of claims 1 to 5 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

10. A program product, characterized in that When the program product is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Neural network classification model knowledge distillation method for passive domain data

    CN115456166A

  • Multi-modal medical data generation method and related device

    CN119830218A