A fast self-consistent sampling method based on speculative decoding and dynamically generated pool
Patent Information
- Application Number
- CN202610855894.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-09-08
AI Technical Summary
[0006]本发明在保证生成质量的前提下,针对现有自洽性采样存在的高延迟问题,提出了一种基于投机解码与动态生成池的快速自洽性采样方法,提升大语言模型推理的效率和生成质量
[0037] Compared to traditional methods that cache key-value vectors for all paths at once, this invention utilizes a dynamic management strategy to support the parallel generation of larger batches or more paths in scenarios involving large-scale models and long sequence generation, thereby improving the overall throughput of the system.
Smart Images

Figure CN122711366A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer science and technology, and relates to a fast self-consistent sampling technique. Background Technology
[0002] Self-consistent sampling is a crucial method for enhancing the reasoning capabilities of large language models. Its core idea is to generate multiple diverse reasoning paths and candidate answers through repeated sampling, and then vote or aggregate these answers based on their consistency to select the most reliable result. This method fully leverages the model's inherent generative diversity, effectively offsetting the randomness and bias introduced by a single sampling. By integrating multiple reasoning paths, self-consistent sampling significantly improves the robustness, accuracy, and verifiability of answers, providing a practical technical approach for building trustworthy and interpretable artificial intelligence systems.
[0003] Compared to conventional inference, traditional self-consistent sampling requires generating and aggregating a large number of candidate paths, resulting in more lexical units and high inference latency. For models with large parameter scales, the parallel generation of multiple inference paths further exacerbates the latency burden. For example, in the AIME 2025 dataset experiment with the Qwen3-8B model, to improve the accuracy from 68% to 82%, an additional 511 inference paths needed to be generated per question, resulting in a total output of approximately 100 million lexical units, significantly increasing computational overhead.
[0004] While existing technologies employ methods such as batch parallel decoding and key-value caching to accelerate generation, the following challenges still exist in self-consistent sampling application scenarios.
[0005] Limited acceleration effect: Parallel generation and key-value caching mainly optimize the speed of single generation, and the overall acceleration is still limited by the number of model parameters; High memory overhead: Multi-path generation requires caching the key-value vectors of each path, which consumes a lot of memory and limits the number of parallel generation paths in a single batch, resulting in an increase in the number of batch processing times; Redundant generation results: Some paths show low quality in the early generation stage, and continuing to generate them will only waste computing power and produce redundant words. Summary of the Invention
[0006] This invention addresses the high latency issue of existing self-consistent sampling methods while ensuring generation quality. It proposes a fast self-consistent sampling method based on speculative decoding and dynamic generation pooling, thereby improving the efficiency and generation quality of reasoning in large language models.
[0007] This invention establishes a collaborative generation mechanism between a small model and a target large model through a speculative decoding module. The small model quickly generates candidate sequences, while the large model performs parallel verification of high-quality candidate sequences. This reduces redundant computation caused by invalid path generation and maintains the consistency and self-consistency of the generation distribution. At the same time, dynamic allocation of computational load is achieved during the generation of multiple inference paths, which significantly improves the overall generation speed.
[0008] The dynamic generation pool module tracks and maintains the status of each path in real time during the generation process. It dynamically adjusts the cache based on the confidence level, entropy value, and historical score of the path sequence, filters out or pauses the expansion of low-quality paths, thereby reducing peak memory usage. When necessary, it performs directional branch expansion of high-confidence paths, thus ensuring the statistical stability and output reliability of self-consistent sampling under limited computing power and memory resources.
[0009] Step 1: Initialize the input configuration, speculative decoding strategy, and dynamic generation pool.
[0010] Step 2: Generate candidate sequences based on the draft model, verify candidate words in parallel based on the target model, update the generated prefix and draft window, and obtain the generation results for the current round.
[0011] Step 3: Update the inference paths in the dynamic generation pool based on the generation results of the current round, define word-level confidence and sequence-level confidence, calculate the screening threshold for the current round, calculate the confidence based on the probability distribution of the target model, compare the generation quality of each inference path, and select the paths to retain based on the confidence index.
[0012] Step 4: Determine whether the termination condition is met based on the update status of the dynamic generation pool. If it is terminated, proceed to step 6. If it is not terminated, determine whether the supplementation condition is met. If the number of samples is sufficient, proceed to step 2. If the number of samples is insufficient, continue to step 5.
[0013] Step 5: Based on the high-quality samples in the current dynamic generation pool, expand new branch inference paths based on high-confidence paths or Top-K high-quality paths to supplement the number of samples.
[0014] Step six: Use majority vote aggregation and weighted aggregation to statistically aggregate the results of the completed reasoning paths and use them as output.
[0015] Input configuration initialization: Initialize the same input... Multiple copies are made to form the initial batch input, which is used to generate multiple candidate inference paths in parallel. The initial batch size is set to the minimum number of parallel samples. or not greater than the maximum number of samples required The default value.
[0016] Speculative Decoding Strategy Initialization: Select a speculative decoding strategy based on deployment conditions. Use standard speculative decoding, which involves selecting a pair of models from the same series as draft models. and target model For example, a model with a smaller number of parameters as Larger parameter models as The draft model is used to quickly propose candidate word sequences, while the target model is used to verify the candidate word sequences in parallel, thereby improving the generation speed while keeping the distribution generated by the target model unchanged.
[0017] Dynamic generation pool initialization: The dynamic generation pool is used to maintain the state information of each inference path. For the first... Each reasoning path records information including the currently generated content. Corresponding key-value cache Candidate word window, confidence window, attention mask; the dynamic generation pool is also used to maintain global parameters, including the minimum number of parallel samples. Maximum number of samples required Confidence screening threshold rules, number of branches expanded in a single instance Key-value cache shared pool.
[0018] Let the current prefix of any inference path be . Draft model In the The conditional probability distribution of each position is as follows: Target model In the The conditional probability distribution of each position is as follows: .
[0019] Generate candidate sequences based on the draft model: based on the current prefix Construct the corresponding attention mask and input the prefix into the draft model. The draft model is based on the current draft window length. Parallel generation of candidate word sequences This yields the draft distribution corresponding to each position. .
[0020] Parallel validation of candidate sequences based on the target model: Candidate word sequences... spliced to the current prefix Then, the sequence to be verified is obtained. Input target model Perform a forward computation to obtain the probability distribution of the target model at each candidate position. This allows for the verification of all candidate words to be completed in parallel.
[0021] Candidate word validation: based on the distribution of the target model Distribution of draft models Greedy verification or speculative sampling is used to verify candidate words one by one.
[0022] Greedy verification: If candidate words satisfy Then determine the first If one candidate word is accepted, it is rejected.
[0023] Speculative sampling: for the first candidate words According to the probability of receiving To make a judgment based on probability. Receive candidate words Continue to verify the next candidate word with probability. Reject candidate words Resample a word from the corrected distribution. The corrected distribution is... It means that among them To ensure that the final sampling results conform to the target model The generation distribution.
[0024] Update the prefix generation and draft window: If the first rejected candidate position in each inference path is... Then keep All accepted candidate words in the position According to the target model distribution Or corrected distribution Generate a new word. Discard all candidate words after the first rejected candidate position. If all candidate words in the current round are accepted, increase the draft window size. Otherwise, reduce the draft window length. To balance acceleration and validation pass rate.
[0025] Define word-level confidence: from the target model distribution Select any generation position Highest probability The words are respectively The corresponding probability is ,Location The word-level confidence level is , The smaller the value, the more concentrated the probability distribution, and the more confident the target model is in its current generation decision. The larger the value, the more uncertain it is.
[0026] Define sequence-level confidence: Suppose a certain inference path is recorded within the confidence window. The path sequence-level average confidence is [value] for each consecutive generation location. , The smaller the value, the more stable and reliable the overall path generation. The larger the value, the more likely the path is to be a low-quality inference path, generating the sequence-level average confidence of each inference path.
[0027] Calculate the current round's screening threshold: the mean of the average confidence scores of all valid paths in the current dynamic generation pool is... ,in This represents the number of valid inference paths in the current dynamic generation pool. For the first The sequence-level average confidence score of each inference path is used, as a lower confidence score indicates higher path quality, so it is retained. The reasoning path, discard The inference path is determined by releasing the key-value cache occupied by discarded paths, and adaptive threshold settings with quantile threshold, moving average threshold, and safety boundary are adopted. .
[0028] If multiple inference paths share the same prefix, a copy of the key-value cache corresponding to the shared prefix is stored in the key-value cache shared pool to reduce video memory usage.
[0029] Save the incremental key-value cache corresponding to the newly added suffix part of each path to avoid the waste of video memory caused by repeatedly storing the same prefix.
[0030] Termination conditions: All inference paths in the dynamic generation pool generate output terminators or reach the maximum generation length; the total number of collected samples reaches the maximum sample requirement. .
[0031] Additional condition: The sum of the number of completed samples and the number of incomplete samples is less than the minimum number of parallel samples. .
[0032] Based on high-confidence paths: Select one or more inference paths with the best average confidence at the sequence level in the current dynamic generation pool, locate positions with high uncertainty, and set the position... The target model distribution is The word distribution entropy is , The larger the entropy value, the more dispersed the available words are, making it suitable for resampling and branch expansion. Resampling can be performed at the position with the highest entropy value or the position that most recently exceeded the preset entropy threshold. Each candidate word is used to copy previous common prefixes and related state information to form a new candidate reasoning path.
[0033] Based on Top-K high-quality paths: Select the sequence with the best average confidence level from the current dynamically generated pool. One reasoning path, from Multiple paths are randomly or weighted to expand the branch until the number of valid samples in the dynamically generated pool is restored to greater than or equal to the number of valid samples in the pool. .
[0034] Majority aggregation: Let the first vote be... The generated reasoning paths are as follows: Using formula Select the most frequently occurring result, among which The final number of samples generated. This is an indicator function.
[0035] Weighted aggregation: based on the average confidence level at the sequence level Construct the first The weight of each path is The final generated result is .
[0036] Weighted aggregation is performed based on the normalized probability of the answer segment, the path length penalty term, and the task-specific scoring function.
[0037] Compared to traditional methods that cache key-value vectors for all paths at once, this invention utilizes a dynamic management strategy to support the parallel generation of larger batches or more paths in scenarios involving large-scale models and long sequence generation, thereby improving the overall throughput of the system.
[0038] This method employs a modular design, treating speculative decoding and dynamic generation pools as independent functional units, which can be flexibly deployed across different model combinations, inference frameworks, and hardware platforms. The size of the small model, the size of the dynamic pool, the confidence threshold, and the speculative strategy are selected based on the specific scenario, thus balancing generation speed, quality, and resource consumption.
[0039] This invention optimizes memory usage, improves multi-path generation speed, and supports various self-consistent aggregation methods, such as majority vote aggregation and weighted confidence aggregation. It can quickly adapt to various application scenarios, including extensions and question-answering systems, code generation, logical reasoning, and code generation, exhibiting good engineering adaptability and scalability. Attached Figure Description
[0040] Figure 1 It is a flowchart of the method. Detailed Implementation
[0041] The present invention will be further described in detail below with reference to the embodiments and the accompanying drawings.
[0042] The method and process are as follows Figure 1 As shown, it includes six steps.
[0043] Step 1: Initialize the input configuration, speculative decoding strategy, and dynamic generation pool.
[0044] Input configuration initialization: Initialize the same input... Multiple copies are made to form the initial batch input, which is used to generate multiple candidate inference paths in parallel. The initial batch size is set to the minimum number of parallel samples. or not greater than the maximum number of samples required The default value.
[0045] Speculative Decoding Strategy Initialization: Select a speculative decoding strategy based on deployment conditions. Use standard speculative decoding, which involves selecting a pair of models from the same series as draft models. and target model For example, a model with a smaller number of parameters as Larger parameter models as The draft model is used to quickly propose candidate word sequences, while the target model is used to verify the candidate word sequences in parallel, thereby improving the generation speed while keeping the distribution generated by the target model unchanged.
[0046] Dynamic generation pool initialization: The dynamic generation pool is used to maintain the state information of each inference path. For the first... Each reasoning path records information including the currently generated content. Corresponding key-value cache Candidate word window, confidence window, attention mask; the dynamic generation pool is also used to maintain global parameters, including the minimum number of parallel samples. Maximum number of samples required Confidence screening threshold rules, number of branches expanded in a single instance Key-value cache shared pool.
[0047] Step 2: Generate candidate sequences based on the draft model, verify candidate words in parallel based on the target model, update the generated prefix and draft window, and obtain the generation results for the current round.
[0048] Let the current prefix of any inference path be . Draft model In the The conditional probability distribution of each position is as follows: Target model In the The conditional probability distribution of each position is as follows: .
[0049] Generate candidate sequences based on the draft model: based on the current prefix Construct the corresponding attention mask and input the prefix into the draft model. The draft model is based on the current draft window length. Parallel generation of candidate word sequences This yields the draft distribution corresponding to each position. .
[0050] Parallel validation of candidate sequences based on the target model: Candidate word sequences... spliced to the current prefix Then, the sequence to be verified is obtained. Input target model Perform a forward computation to obtain the probability distribution of the target model at each candidate position. This allows for the verification of all candidate words to be completed in parallel.
[0051] Candidate word validation: based on the distribution of the target model Distribution of draft models Greedy verification or speculative sampling is used to verify candidate words one by one.
[0052] Greedy verification: If candidate words satisfy Then determine the first If one candidate word is accepted, it is rejected.
[0053] Speculative sampling: for the first candidate words According to the probability of receiving To make a judgment based on probability. Receive candidate words Continue to verify the next candidate word with probability. Reject candidate words Resample a word from the corrected distribution. The corrected distribution is... It means that among them To ensure that the final sampling results conform to the target model The generation distribution.
[0054] Update the prefix generation and draft window: If the first rejected candidate position in each inference path is... Then keep All accepted candidate words in the position According to the target model distribution Or corrected distribution Generate a new word. Discard all candidate words after the first rejected candidate position. If all candidate words in the current round are accepted, increase the draft window size. Otherwise, reduce the draft window length. To balance acceleration and validation pass rate.
[0055] Step 3: Update the inference paths in the dynamic generation pool based on the generation results of the current round, define word-level confidence and sequence-level confidence, calculate the screening threshold for the current round, calculate the confidence based on the probability distribution of the target model, compare the generation quality of each inference path, and select the paths to retain based on the confidence index.
[0056] Define word-level confidence: from the target model distribution Select any generation position Highest probability The words are respectively The corresponding probability is ,Location The word-level confidence level is , The smaller the value, the more concentrated the probability distribution, and the more confident the target model is in its current generation decision. The larger the value, the more uncertain it is.
[0057] Define sequence-level confidence: Suppose a certain inference path is recorded within the confidence window. The path sequence-level average confidence is [value] for each consecutive generation location. , The smaller the value, the more stable and reliable the overall path generation. The larger the value, the more likely the path is to be a low-quality inference path, generating the sequence-level average confidence of each inference path.
[0058] Calculate the current round's screening threshold: the mean of the average confidence scores of all valid paths in the current dynamic generation pool is... ,in This represents the number of valid inference paths in the current dynamic generation pool. For the first The sequence-level average confidence score of each inference path is used, as a lower confidence score indicates higher path quality, so it is retained. The reasoning path, discard The inference path is determined by releasing the key-value cache occupied by discarded paths, and adaptive threshold settings with quantile threshold, moving average threshold, and safety boundary are adopted. .
[0059] If multiple inference paths share the same prefix, a copy of the key-value cache corresponding to the shared prefix is stored in the key-value cache shared pool to reduce video memory usage.
[0060] Save the incremental key-value cache corresponding to the newly added suffix part of each path to avoid the waste of video memory caused by repeatedly storing the same prefix.
[0061] Step 4: Determine whether the termination condition is met based on the update status of the dynamic generation pool. If it is terminated, proceed to step 6. If it is not terminated, determine whether the supplementation condition is met. If the number of samples is sufficient, proceed to step 2. If the number of samples is insufficient, continue to step 5.
[0062] Termination conditions: All inference paths in the dynamic generation pool generate output terminators or reach the maximum generation length; the total number of collected samples reaches the maximum sample requirement. .
[0063] Additional condition: The sum of the number of completed samples and the number of incomplete samples is less than the minimum number of parallel samples. .
[0064] Step 5: Based on the high-quality samples in the current dynamic generation pool, expand new branch inference paths based on high-confidence paths or Top-K high-quality paths to supplement the number of samples.
[0065] Step 3 involves dynamically eliminating low-quality inference paths to ensure the statistical stability of self-consistent sampling and to make the final number of effective samples close to the maximum required number of samples. The number of valid paths in the dynamic generation pool must be no less than the minimum number of parallel samples required for subsequent voting. At that time, new branches are extended from high-quality paths.
[0066] Based on high-confidence paths: Select one or more inference paths with the best average confidence at the sequence level in the current dynamic generation pool to locate positions with high uncertainty.
[0067] Set position The target model distribution is The word distribution entropy is , The larger the entropy value, the more dispersed the available words are, making it suitable for resampling and branch expansion. Resampling can be performed at the position with the highest entropy value or the position that most recently exceeded the preset entropy threshold. Each candidate word is used to copy previous common prefixes and related state information to form a new candidate reasoning path.
[0068] Based on Top-K high-quality paths: Select the sequence with the best average confidence level from the current dynamically generated pool. One reasoning path, from Multiple paths are randomly or weighted to expand the branch until the number of valid samples in the dynamically generated pool is restored to greater than or equal to the number of valid samples in the pool. .
[0069] Step six: Use majority vote aggregation and weighted aggregation to statistically aggregate the results of the completed reasoning paths and use them as output.
[0070] Majority aggregation: Let the first vote be... The generated reasoning paths are as follows: Using formula Select the most frequently occurring result, among which The final number of samples generated. This is an indicator function.
[0071] Weighted aggregation: based on the average confidence level at the sequence level Construct the first The weight of each path is The final generated result is .
[0072] Weighted aggregation is performed based on the normalized probability of the answer segment, the path length penalty term, and the task-specific scoring function.
[0073] Through the above six steps, this invention combines speculative decoding with dynamic generation pooling without changing the sampling distribution of the target model or the final decision logic.
[0074] This invention accelerates the multi-path generation process by utilizing a collaborative verification mechanism between the draft model and the target model. On the other hand, it improves the self-consistent sampling efficiency and output quality under limited computing power and memory resources by dynamically filtering out low-quality paths and expanding the directional branches of high-value nodes.
Claims
1. A fast self-consistent sampling method based on speculative decoding and dynamic generation pooling, characterized in that, include: Step 1: Initialize the input configuration, speculative decoding strategy, and dynamic generation pool; Step 2: Generate candidate sequences based on the draft model, verify candidate words in parallel based on the target model, update the generated prefix and draft window, and obtain the generation results of the current round; Step 3: Update the inference paths in the dynamic generation pool based on the generation results of the current round, define word-level confidence and sequence-level confidence, calculate the screening threshold for the current round, calculate the confidence based on the probability distribution of the target model, compare the generation quality of each inference path, and select the paths to retain based on the confidence index. Step 4: Determine whether the termination condition is met based on the update status of the dynamic generation pool. If it is terminated, proceed to step 6. If it is not terminated, determine whether the supplementation condition is met. If the number of samples is sufficient, proceed to step 2. If the number of samples is insufficient, continue to step 5. Step 5: Based on the high-quality samples in the current dynamic generation pool, expand new branch inference paths based on high-confidence paths or Top-K high-quality paths to supplement the number of samples; Step six: Use majority vote aggregation and weighted aggregation to statistically aggregate the results of the completed reasoning paths and use them as output.
2. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 1, characterized in that, Step one, input configuration initialization, includes: setting the same input... Multiple copies are made to form the initial batch input, which is used to generate multiple candidate inference paths in parallel. The initial batch size is set to the minimum number of parallel samples. or not greater than the maximum number of samples required The preset value; the initialization of the speculative decoding strategy includes: selecting a speculative decoding strategy according to the deployment conditions, adopting standard speculative decoding, and selecting a pair of models of the same series as draft models. and target model The draft model is used to quickly generate candidate word sequences, and the target model is used to perform parallel verification of the candidate word sequences; the initialization of the dynamic generation pool includes: the dynamic generation pool is used to maintain the state information of each inference path, for the first... Each reasoning path records information including the currently generated content. The corresponding key-value cache Candidate word window, confidence window, attention mask; the dynamic generation pool is also used to maintain global parameters, including the minimum number of parallel samples. Maximum number of samples required Confidence screening threshold rules, number of branches expanded in a single instance Key-value cache shared pool.
3. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 2, characterized in that, Step two includes: assuming the current prefix of any inference path is... Draft model In the The conditional probability distribution of each position is as follows: Target model In the The conditional probability distribution of each position is as follows: .
4. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 3, characterized in that, Step two, generating candidate sequences based on the draft model, includes: based on the current prefix Construct the corresponding attention mask and input the prefix into the draft model. The draft model is based on the current draft window length. Parallel generation of candidate word sequences This yields the draft distribution corresponding to each position. The parallel verification of candidate sequences based on the target model includes: processing candidate word sequences... spliced to the current prefix Then, the sequence to be verified is obtained. Input target model Perform a forward computation to obtain the probability distribution of the target model at each candidate position. This is done in parallel to verify all candidate words; the candidate word verification includes: based on the target model distribution... Distribution of draft models Greedy verification or speculative sampling is used to verify candidate words one by one; the update generates a prefix and a draft window: if the first rejected candidate position in each inference path is... Then keep All accepted candidate words in the position According to the target model distribution Or corrected distribution Generate a new word. Discard all candidate words after the first rejected candidate position. If all candidate words in the current round are accepted, increase the draft window size. Otherwise, reduce the draft window length. .
5. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 4, characterized in that, Step two, greedy verification, includes: if candidate words satisfy Then determine the first The candidate word is accepted if it is not accepted otherwise; the speculative sampling includes: for the first candidate word... candidate words According to the probability of receiving Make a judgment based on probability. Receive candidate words Continue to verify the next candidate word with probability. Reject candidate words Resample a word from the corrected distribution. The corrected distribution is... It means that among them This ensures that the final sampling results conform to the target model. The generation distribution.
6. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 1, characterized in that, Step three defines word-level confidence, including: from the target model distribution Select any generation position Highest probability The words are respectively The corresponding probability is ,Location The word-level confidence level is The definition of sequence-level confidence includes: assuming a certain inference path is recorded within the confidence window. The path sequence-level average confidence is [value] for each consecutive generation location. The sequence-level average confidence score of each inference path is generated; the calculation of the current round's screening threshold includes: the mean of the average confidence scores of all valid paths in the current dynamic generation pool is... ,in This represents the number of valid inference paths in the current dynamic generation pool. For the first The sequence-level average confidence of each inference path, retaining The reasoning path, discard The inference path is determined by releasing the key-value cache occupied by discarded paths, and adaptive threshold settings with quantile threshold, moving average threshold, and safety boundary are adopted. .
7. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 6, characterized in that, Step three further includes: if multiple inference paths share the same prefix, then a key-value cache corresponding to the shared prefix is stored in the key-value cache shared pool; and the incremental key-value cache corresponding to the newly added suffix part of each path is stored.
8. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling as described in claim 2, characterized in that, The termination conditions for step four include: all inference paths in the dynamic generation pool generate output terminators or reach the maximum generation length; the total number of collected samples reaches the maximum sample requirement. The supplementary condition includes: the sum of the number of completed samples and the number of incomplete samples is less than the minimum number of parallel samples. .
9. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling according to claim 2, characterized in that, Step five, based on high-confidence paths, includes: selecting one or more inference paths with the optimal average confidence at the sequence level in the current dynamic generation pool, locating positions with higher uncertainty, and setting the position... The target model distribution is The word distribution entropy is Resample at the position with the highest entropy or the position where the preset entropy threshold was most recently exceeded. Each candidate word is used to copy its previous common prefixes and related state information to form a new candidate inference path. The Top-K high-quality path selection includes: selecting the sequence with the best average confidence from the current dynamically generated pool. One reasoning path, from Multiple paths are randomly or weighted to expand the branch until the number of valid samples in the dynamically generated pool is restored to greater than or equal to the number of valid samples in the pool. .
10. The fast self-consistent sampling method based on speculative decoding and dynamic generation pooling according to claim 1, characterized in that, The sixth step, majority vote aggregation, includes: assuming the first... The generated reasoning paths are as follows: Using formula Select the most frequently occurring result, among which The final number of samples generated. The indicator function; the weighted aggregation includes: according to the sequence-level average confidence score. Construct the first The weight of each path is The final generated result is The weighted aggregation further includes: using normalized probability based on answer segments, path length penalty terms, and task-specific scoring functions.