Large model inference path aggregation method and system based on counterfactual path sensitivity
Patent Information
- Application Number
- CN202611336486.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-09-29
AI Technical Summary
[0005]本发明的目的在于解决现有技术中标准自一致性等权投票方式难以区分路径可靠性的问题,并提出一种基于反事实路径敏感度的大模型推理路径聚合方法及系统
[0032]本发明提供了一种基于反事实路径敏感度的大模型推理路径聚合方法,该方法采用了从路径采样、局部反事实探测、敏感度特征提取到加权自一致性聚合的完整流程,其具有以下多方面的优势:
Smart Images

Figure CN122840267A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and natural language processing technology, and in particular relates to a method for reliability assessment and weighted aggregation of multiple inference paths generated by a large language model based on counterfactual path sensitivity. Background Technology
[0002] Large language models, guided by thought chain prompts, can generate intermediate reasoning processes and demonstrate strong reasoning capabilities in mathematical, scientific, and knowledge-intensive tasks. Inference-time extension techniques further sample multiple reasoning paths during the reasoning phase and aggregate candidate answers from different paths. Self-consistency is a representative method, its basic approach being to sample multiple diverse thought chains for the same question and select the answer supported by the majority of paths, rather than relying on a single greedy decoding path.
[0003] The main limitation of standard self-consistency is that it assumes all paths have the same reliability after extracting candidate answers. In reality, different paths may converge to the same answer through inference processes with significantly different quality, and a seemingly smooth path may depend on a fragile or erroneous intermediate step. When the path budget is small, the candidate answer count is sparser, and the majority vote is more easily influenced by minority-sampled paths. Therefore, relying solely on the consistency of the final answer is insufficient to adequately assess path reliability.
[0004] Existing weighted aggregation methods typically utilize observed signals from the original generation process or additionally learned scorers. The former may include lexical likelihood, model-reported confidence, semantic similarity, or reasoning text features; however, these signals only read information already present in the original trajectory and cannot test the response when the path's intermediate premises are locally altered. The latter may include outcome validators, process reward models, or step-level scorers, but usually require additional supervision, training data, or trained scoring models. On the other hand, counterfactual perturbations have been used to analyze the thought chain reasoning process, but their signals are mostly used for diagnosis, training data, or reward construction, and have not yet been fully utilized for self-consistent aggregation in the reasoning stage. Summary of the Invention
[0005] The purpose of this invention is to address the problem that standard self-consistent equal-weighted voting methods in the prior art struggle to distinguish path reliability, and to propose a large-model inference path aggregation method and system based on counterfactual path sensitivity. This method addresses the difficulty of standard self-consistent equal-weighted voting in distinguishing path reliability by applying local counterfactual editing to the intermediate inference steps of each sampled inference path, and then having the same principal inference model continue generating counterfactual continuations from the edited prefixes. Subsequently, result sensitivity features, propagation sensitivity features, and distribution sensitivity features are extracted from the pairing differences between the original path and the counterfactual path, converted into path scores and voting weights, and finally, weighted self-consistent aggregation of candidate answers for the original path is performed.
[0006] The specific technical solution adopted in this invention is as follows:
[0007] In a first aspect, the present invention provides a method for large-scale model inference path aggregation based on counterfactual path sensitivity, comprising:
[0008] S1. For the input question, multiple original reasoning paths are sampled by the main reasoning model. Each original reasoning path contains a reasoning process and its corresponding candidate answer.
[0009] S2. For each original reasoning path, perform local counterfactual replacement on the target segment within an intermediate reasoning step. Use the replaced intermediate reasoning step and all previous reasoning steps as the edited prefix. Then, the main reasoning model generates a counterfactual continuation based on the edited prefix to obtain a counterfactual reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, not the candidate answer itself, and does not belong to the conditions explicitly given in the input question.
[0010] S3. For each pair of original reasoning paths and counterfactual reasoning paths, extract sensitivity descriptors to characterize the differences between them. The sensitivity descriptors include outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors.
[0011] S4. For all original inference paths, the sensitivity descriptor is mapped to a feature representation and the voting weight is calculated. Then, the candidate answers of each original inference path are weighted and aggregated to obtain the final output answer.
[0012] As a preferred embodiment of the first aspect, in S1, the sampled multiple original inference paths share the same set of sampling configurations, and the inference process in each original inference path needs to be parsed into an ordered sequence of inference steps according to the preset parsing rules; when the number of inference steps in the inference process is not less than two, the second inference step is selected as the intermediate inference step in which the target segment is located.
[0013] As a preferred embodiment of the first aspect above, in S2, the local counterfactual replacement is performed by an auxiliary editing module based on a large language model and follows a constrained fragment replacement protocol. It only replaces the target fragments already existing in the intermediate inference step, without adding, deleting, or rewriting the entire step, and verification is required after the replacement is completed. The constrained fragment replacement protocol includes one of single fragment replacement, locally consistent fragment replacement, and multi-fragment replacement, and multi-fragment replacement is only used as a fallback method when there are multiple non-continuous target fragments in the intermediate inference step.
[0014] As a preferred embodiment of the first aspect above, in S3, the result sensitivity descriptor includes an answer reversal descriptor, which measures whether the counterfactual substitution has changed the candidate answer; if it has changed, the value is 1, otherwise it is 0.
[0015] As a preferred embodiment of the first aspect above, in S3, the propagation sensitivity descriptor includes error absorption rate, original fragment reference rate, propagation coverage, and recovery delay;
[0016] The error absorption rate is the percentage of steps in all steps of counterfactual continuation that match counterfactual segments.
[0017] The original fragment citation rate is the percentage of steps in all steps of the counterfactual continuation that match the original fragment.
[0018] The propagation coverage is the number of continuation steps included in the counterfactual continuation;
[0019] The recovery delay is the reciprocal of the step number in the counterfactual continuation process when the first counterfactual disturbance is matched, corrected, rolled back, or rejected.
[0020] As a preferred embodiment of the first aspect mentioned above, in S3, the distribution sensitivity descriptor includes the answer-level log probability difference, the continuation-level confidence difference, the local negative log-likelihood shift, and the continuation length deviation; the answer-level log probability difference is the difference between the log probabilities of the counterfactual candidate answer and the original candidate answer averaged per word; the continuation-level confidence difference is the difference between the log probabilities of the counterfactual continuation and the original continuation averaged per word; the local negative log-likelihood shift is the difference in negative log-likelihood between the counterfactual continuation and the original continuation within a preset number of words at the beginning of the continuation; the continuation length deviation is calculated using the degree to which the ratio of the length of the counterfactual continuation to the length of the original continuation deviates from 1 as the independent variable, through a monotonically decreasing kernel function.
[0021] As a preferred embodiment of the first aspect mentioned above, in S4, each sensitivity descriptor is mapped and converted into sensitivity features, and the sensitivity features of each original inference path for the same input question are normalized on each feature dimension. Then, for each original inference path, the normalized sensitivity features are linearly combined using a pre-calibrated feature weight vector to obtain the path score of each original inference path, and further converted into voting weights using a normalized exponential function with a temperature parameter. Finally, the candidate answers of each original inference path are weighted and majority voted according to the voting weights to determine the final answer.
[0022] Secondly, this invention provides a large-scale model reasoning path aggregation system based on counterfactual path sensitivity, comprising:
[0023] The path sampling module is used to sample multiple original reasoning paths from the main reasoning model for the input question. Each original reasoning path contains a reasoning process and its corresponding candidate answer.
[0024] The local counterfact detection module is used to perform local counterfact replacement on the target segment within an intermediate reasoning step for each original reasoning path. The replaced intermediate reasoning step and all the reasoning steps before it are used as the edited prefix. The main reasoning model then generates a counterfact continuation based on the edited prefix to obtain a counterfact reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, rather than the candidate answer itself, and does not belong to the conditions explicitly given in the input question.
[0025] The sensitivity descriptor extraction module is used to extract sensitivity descriptors that characterize the differences between each pair of original reasoning paths and counterfactual reasoning paths. The sensitivity descriptors include outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors.
[0026] The path scoring module is used to map the sensitivity descriptor to feature representation for each of the original inference paths, calculate the voting weight, and then perform weighted aggregation of the candidate answers for each original inference path to obtain the final output answer.
[0027] Thirdly, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, can implement the large model inference path aggregation method based on counterfactual path sensitivity as described in any of the solutions in the first aspect above.
[0028] Fourthly, the present invention provides an electronic device including a memory and a processor;
[0029] The memory is used to store computer programs;
[0030] The processor is configured to, when executing the computer program, implement the large model inference path aggregation method based on counterfactual path sensitivity as described in any of the first aspects above.
[0031] Compared with the prior art, the present invention has the following advantages:
[0032] This invention provides a method for large-scale model inference path aggregation based on counterfactual path sensitivity. This method employs a complete process from path sampling, local counterfactual detection, sensitivity feature extraction to weighted self-consistent aggregation, and has the following advantages:
[0033] First, this invention preserves the diversity of answers brought about by multi-path sampling, but no longer assumes that all paths have the same reliability. Instead, it calculates the weight associated with the counterfactual response for each path.
[0034] Secondly, the reliability evidence used in this invention comes from the continuation behavior of the subject reasoning model after editing the prefix, which can characterize the changes in the answer, propagation process and distribution reliability after the local intermediate premise is changed.
[0035] Third, this invention does not train external validators, reward models, or step-level scorers, and the auxiliary editing module is only used to generate local replacements, thus avoiding using external judges as a source of path correctness.
[0036] Fourth, when the path budget is small, the standard majority vote is easily affected by the minority path. This invention alleviates this problem by using non-uniform weights, and is therefore applicable to the aggregation of inference results under finite path budgets.
[0037] In summary, compared to standard self-consistency, this invention no longer considers all paths to be equally reliable; compared to weighted methods that only use observed signals, this invention introduces response signals generated by local counterfactual intervention; and compared to validator-based methods, this invention does not train external validators, reward models, or step-level scorers. The auxiliary editing module is only used to generate local fragment replacements and is not used for scoring, ranking, comparing, or judging inference paths. Therefore, this invention does not require training external validators, reward models, or step-level scorers, which can improve the reliability and accuracy of multi-path inference results, and is especially suitable for inference scenarios with limited path budgets. Attached Figure Description
[0038] Figure 1 The flowchart shows the steps of the reasoning path aggregation method based on counterfactual path sensitivity.
[0039] Figure 2 An exemplary process for performing partial counterfactual probing;
[0040] Figure 3 This is an example of a weighted self-consistent computation process;
[0041] Figure 4 A schematic diagram of the module composition of a reasoning path aggregation system based on counterfactual path sensitivity;
[0042] Figure 5 This is a schematic diagram of the structure of a computer electronic device. Detailed Implementation
[0043] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in various embodiments of the present invention can be combined accordingly without mutual conflict.
[0044] To avoid confusion in terminology, this invention first explains the concepts of some technical terms. In this invention, "self-consistency" refers to a reasoning aggregation method that samples multiple thought chain reasoning paths for the same problem and determines the answer through majority voting; "counterfactual path sensitivity" refers to the change in the main reasoning model's continuation behavior relative to the original path after partially editing intermediate reasoning steps; "main reasoning model" is a large language model that generates the original path and continues to generate counterfactual continuations from the edit prefix; "auxiliary editing module" is only responsible for generating counterfactual replacement fragments and does not participate in path scoring; "weighted self-consistency" refers to voting on each original candidate answer according to the path reliability weight; "original path" refers to the sampled thought chain and its candidate answers without counterfactual editing, and "counterfactual path" refers to the path and its answer obtained by continuing from the same main reasoning model on the edit prefix; "target fragment" refers to the replaced intermediate quantity or asserted sub-conclusion, and "counterfactual fragment" refers to the replaced local content; "path weight" refers to the weight used for the final weighted self-consistency vote, rather than a direct judgment of the correctness of the answer. Based on the above conceptual definitions, the technical solution of this invention is further described below.
[0045] like Figure 1 As shown, this invention provides a method for large-scale model inference path aggregation based on counterfactual path sensitivity, which includes steps S1 to S4. The specific implementation of each step is described in detail below.
[0046] S1. Path Sampling: For the input question, the main reasoning model samples multiple original reasoning paths. Each original reasoning path contains a reasoning process and its corresponding candidate answer.
[0047] In an embodiment of the present invention, during path sampling, assuming a given input question x, the main reasoning model M samples N original reasoning paths:
[0048]
[0049] in Indicates the first A chain of thought reasoning paths, This represents the candidate answer extracted from this reasoning path.
[0050] The multiple original inference paths sampled by the main inference model M share the same set of sampling configurations (i.e., the sampling parameters such as temperature, random seed, and maximum generation length are the same), and the specific number of sampling paths N is a parameter that can be adjusted and optimized according to actual conditions. The inference process in each original inference path is a thought chain composed of a long string of continuous natural language, which can be parsed into an ordered sequence of inference steps according to parsing rules such as numbering marks and line breaks. For example, when there are explicit numbering marks such as "Step1:", "1.", and "Step (1)" in the inference process text, the inference steps can be divided based on these marks. Similarly, some inference processes are separated by line breaks, and in this case, line breaks can also be used as the basis for dividing the inference steps.
[0051] In traditional standard self-consistency, the final aggregated answer is obtained through equal-weighted majority voting, expressed by the formula:
[0052]
[0053] in This is an indicator function.
[0054] However, this standard-based self-consistency aggregation method assigns the same weight to all paths, assuming that all paths have the same reliability, which can lead to inaccurate answer aggregation results in some cases. Therefore, this invention constructs a counterfactual corresponding path for each path and estimates the path weight based on the paired responses between the original path and the counterfactual path, thereby improving the accuracy of the answer aggregation results.
[0055] S2. Local Counterfactual Detection: For each original reasoning path, a local counterfactual replacement is performed on the target segment within an intermediate reasoning step. The replaced intermediate reasoning step and all the reasoning steps before it are used as the edited prefix. The main reasoning model then generates a counterfactual continuation based on the edited prefix to obtain a counterfactual reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, rather than the candidate answer itself, and does not belong to the conditions explicitly given in the input question.
[0056] For ease of description, the intermediate reasoning steps described above, in which partial counterfactual substitution is performed, can be referred to as intervention steps. Index of Intervention Steps It is a configurable detection selection, which can be determined according to at least one rule selected from preset location, path length, step importance, entity appearance location, or numerical appearance location. In an embodiment of the present invention, a preset location rule can be used to determine the intervention step. The rule is set as follows: when the original inference path contains at least two steps, take... That is, the second reasoning step is selected as the intervention step.
[0057] In this invention, the intervention steps of the i-th original reasoning path are denoted as... Intervention steps The present invention selects a target fragment in this step. Perform a local counterfactual substitution. The target fragment is an intermediate quantity or an asserted sub-conclusion, such as a numerical value, a named entity, or a short factual clause, rather than the final candidate answer itself. An intermediate quantity is an intermediate product (such as an intermediate calculation result or intermediate variable) that is calculated or introduced in a certain intermediate reasoning step of the reasoning path to arrive at the result of that step or subsequent steps. An asserted sub-conclusion is a propositional intermediate conclusion that is explicitly asserted in a certain intermediate reasoning step of the reasoning path and serves as a premise or basis for the derivation of subsequent steps. Both of these are distinct from the final candidate answer output by the reasoning path.
[0058] It should be noted that this partial counterfactual substitution is based on a reasoning model independent of the subject. The auxiliary editing module is generated by calling a large language model. However, it should be noted that the auxiliary editing module is only used to locally intervene in the context to generate replacement fragments. It does not access other sampling paths, truth labels, validation results, or path scoring signals, nor is it used to score, sort, compare, or judge paths.
[0059] The local counterfactual substitutions performed by the auxiliary editing module follow a constrained fragment substitution protocol. The specific protocol requirements are: the conditional information explicitly given in the input question is not modified; only the target fragments already existing in the selected intervention steps are replaced; no appending, inserting, or rewriting of the entire step is allowed; and intermediate quantities or asserted sub-conclusions obtained through derivation are modified first.
[0060] Furthermore, in the aforementioned constrained fragment replacement protocol, the replacement mode for the target fragment can include three types: single fragment replacement, locally consistent fragment replacement, and multi-fragment replacement used when the target is not continuous. During counterfactual replacement, the auxiliary editing module first calls the large language model to return the target fragment and its corresponding counterfactual fragment according to the corresponding fragment replacement protocol, and then performs the actual editing, i.e., substring replacement operation.
[0061] In single-fragment replacement, the auxiliary editing module returns an exact target fragment substring and its counterfactual fragment substring. For example, if the intervention step is "Step 2: Transpose to get x=12-5=7", the target fragment substring returned in single-fragment replacement mode is "7", and the corresponding counterfactual fragment substring is "9". In this case, only a single numerical fragment is perturbed.
[0062] In locally consistent fragment replacement, when the same derivation result appears repeatedly in a local expression or conclusion within an intervention step, a continuous substring covering these repeated target fragments and their corresponding counterfactual fragment substrings are returned. For example, if the content of the intervention step is "Step 2: Rearranging terms, we get x = 12 - 5 = 7, that is, the value of x is 7.", in locally consistent fragment replacement mode, if we want to perturb the numerical fragment "7", we need to consider the two related numbers in the same step to ensure local consistency and avoid contradictions. Therefore, the returned target fragment substring is "x = 12 - 5 = 7, that is, the value of x is 7", and the corresponding counterfactual fragment substring is "x = 12 - 5 = 9, that is, the value of x is 9". The replacement is then completed by completely replacing the target fragment substring with the counterfactual fragment substring.
[0063] In multi-segment replacement, only when the target is indeed discontinuous is multiple discontinuous target segment substrings and their corresponding counterfactual segment substrings returned. For example, the intervention steps are: "Step 2: Rearrange x+5=12 to get x=7; Substitute and verify, 7+5=12, which matches the question; therefore, x is indeed 7." If the target segment is determined to be the numerical segment "7", it appears three times: "x=7", "7+5", and "x is indeed 7". These three places are separated by "Rearrange x+5=12 to get", "Substitute and verify", and "Matches the question; therefore", etc. Replacing all continuous substrings would cause too much disturbance. In this case, three target segment substrings and counterfactual segment substrings are returned simultaneously, that is, replacing "7" in "x=7" with "9", replacing "7" in "7+5" with "9", and replacing "7" in "x is indeed 7" with "9". Therefore, multi-segment replacement is actually used as a fallback method when the target segment is not continuous, while single-segment replacement or locally consistent segment replacement is still preferred when the target segment is continuous.
[0064] The common requirement of the three replacement modes is to keep the rest of the text unchanged as much as possible, so that the perturbation is limited to the target segment, and the subsequent changes mainly reflect the response of the subject inference model to the local perturbation.
[0065] Once the auxiliary editing module obtains the target segment and its corresponding counterfactual segment, it can perform a replacement operation on the content of the intervention step. This involves editing the target segment substring in the intervention step to replace it with the counterfactual segment substring. If multiple segments need to be replaced, the editing can be performed sequentially. (Regarding the intervention steps...) Suppose we need to extract the target fragment. Replace with counterfactual excerpts This fragment replacement operation It can be represented as:
[0066]
[0067] In the formula: This refers to the intervention steps following counterfactual substitution.
[0068] After performing the replacement operation, the validity of the edited result can be verified: the target string should appear in the original step, and the edited step should be different from the original step. Furthermore, the replacement should not change the conditions explicitly given in the problem (i.e., the input question). If the edited result format is invalid, the target cannot be matched, or the replacement does not produce a change, a retry can be initiated with feedback, requesting the auxiliary editing module to re-provide the target fragment. This retry process is only used to obtain valid local perturbations and is not used to select, evaluate, or filter inference paths.
[0069] Finally, the replaced intermediate reasoning step and all the reasoning steps preceding it are used as the edited prefix, which is represented as:
[0070]
[0071] Subject reasoning model M from the edited prefix Continue generating counterfactual continuations and counterfactual candidate answers Instead of solving the problem from scratch, this continuation process can be represented as:
[0072]
[0073] In the formula: Counterfactual continuation Corresponding to the complete reasoning path excluding the prefix The remaining content, besides the above, exists in the form of natural language. Counterfactual continuation. It can also be parsed into an ordered sequence of reasoning steps based on the aforementioned parsing rules. The set of steps in counterfactual continuation can be represented as follows: .
[0074] Therefore, based on the edited prefix And counterfactual continuation This can form a complete counterfactual reasoning path, denoted as... .like Figure 2 The diagram illustrates an exemplary counterfactual substitution process, which uses the second step as an intervention step to generate a complete counterfactual reasoning path. Therefore, each original reasoning path in this invention... Both are related to a counterfactual reasoning path. Pairing is performed, and subsequent features are calculated from the differences between the pairs.
[0075] S3. Sensitivity Descriptor Extraction: For each pair of original reasoning paths and counterfactual reasoning paths, extract sensitivity descriptors to characterize the differences between them. The sensitivity descriptors include three categories: outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors.
[0076] For ease of description, the original sensitivity descriptor extracted from the pairing of the original reasoning path and the counterfactual reasoning path in this invention is denoted as... Sensitivity descriptor It contains a series of sensitivity descriptor components, but no single component is used as an independent correctness judgment; the path score is calculated by comprehensively evaluating the entire set of descriptors. In the embodiments of the present invention, the calculation process of the result sensitivity feature, propagation sensitivity feature, and distribution sensitivity feature is detailed below.
[0077] (a) Result sensitivity descriptor.
[0078] In embodiments of the present invention, the result sensitivity descriptor employs the answer-flip descriptor, which measures whether the counterfactual substitution has altered the normalized candidate answer; if it has, the value is 1, otherwise it is 0. The answer-flip descriptor can be defined using an indicator function. To calculate:
[0079]
[0080] in This represents a task-related answer normalization function, used to normalize candidate answers for the original inference path. And candidate answers for counterfactual reasoning paths Normalization is then performed. This answer normalization function can utilize existing techniques or be designed independently, as long as it can normalize answers generated by different reasoning paths to a level that allows for comparison. Since the types of answers differ across test datasets for different tasks, the answer normalization function in this embodiment is designed as follows: For AIME, numerical normalization and integer matching are used; for MMLU-Pro, option letter normalization and matching are used; for MATH500, mathematical expression format normalization is performed first, followed by calling the math_verify evaluator to determine symbolic equivalence (e.g., 0.5 and 1 / 2 should be equivalent).
[0081] (ii) Propagation sensitivity descriptor.
[0082] In embodiments of the present invention, the propagation sensitivity descriptor includes error absorption rate, original fragment reference rate, propagation coverage, and recovery delay, the specific calculation methods of which are described in detail below.
[0083] set up This is the set of steps in a counterfactual continuation, and the number of steps is... .definition Represents a value or fragment Whether in the steps The middle part is matched.
[0084] The error absorption rate is defined as the percentage of steps in counterfactual continuation that match a counterfactual fragment, and its expression is:
[0085]
[0086] The original fragment citation rate is defined as the percentage of steps in the counterfactual continuation that match the original fragment, and its expression is:
[0087]
[0088] The error absorption rate and original fragment citation rate mentioned above measure the frequency of counterfactual fragments and original fragments appearing in the continuation, respectively.
[0089] Propagation coverage is defined as the number of continuation steps included in a counterfactual continuation, and its expression is:
[0090]
[0091] In the formula This represents the modulus length operation, which can compute a set of steps. The number of steps in the equation represents the downstream inference quantity available for perturbation propagation.
[0092] Recovery latency is defined as the reciprocal of the step number in counterfactual continuation where a corrective, backtracking, or rejection of a counterfactual perturbation is first encountered. In practical terms, it represents how long it takes for the model to become aware of the perturbation in the prefix after it has been injected with a counterfactual perturbation (this can be identified by the explicit appearance of linguistic signals indicating correction / backtracking / rejection of such perturbations during model inference). If the set of steps in counterfactual continuation... Since the steps are numbered sequentially, the step number of the first instance of identifying such a characteristic language signal can be used to calculate the time delay. The shorter the time it takes to realize the perturbation during the continuation process (the smaller the step number), the more sensitive the model is to the perturbation and the earlier it can correct / back off / reject the interference injected by previous counterfactual substitution operations. Therefore, if the first step number is matched in the counterfactual continuation... The first appearance of a linguistic signal indicating explicit correction, backoff, or rejection of the disturbed premise in this step signifies that disturbance recovery has been detected. The formula for recovery delay is as follows:
[0093]
[0094] in This indicates that no significant linguistic signals of explicit correction, regression, or rejection of the disturbed premise were detected throughout the entire counterfactual continuation. .
[0095] It should be noted that the calculation of the error absorption rate, original fragment reference rate, and recovery delay all require matching operations to determine some parameters in the expression. For example, calculating the error absorption rate requires matching counterfactual fragments in all steps of counterfactual continuation, while calculating the original fragment reference rate requires matching the original fragment in all steps of counterfactual continuation. Calculating the recovery delay requires matching whether explicit linguistic signals of correction, rollback, or rejection of counterfactual perturbations appear in each step of counterfactual continuation. To ensure matching accuracy, deterministic matching rules can be used to match character substrings in embodiments of this invention. For numerical targets, numeric boundary matching can be used to avoid miscounting a value when it is only a substring of a longer number; for multi-word text targets, case-insensitive substring matching can be used; for shorter text targets, word boundary matching can be used. The recovery delay is determined based on whether explicit signals of correction, rollback, or rejection of the perturbed premise appear during continuation. All of the above rules are used to extract descriptors from the text pairings of the original path and counterfactual path, rather than introducing a new learned evaluator.
[0096] It is particularly important to note that in counterfactual continuation, matching for the presence of linguistic signals indicating explicit correction, regression, or rejection of the perturbed premise in a step can be achieved by scanning step-by-step after defining a predefined library of linguistic signals. In embodiments of the present invention, the set of steps in counterfactual continuation can be... A step-by-step scan is performed, and at each step, string matching is used to determine the presence of characteristic linguistic signals. These signals include words or phrases such as wrong, incorrect, mistake, should be, recalculate, and reconsider. Additionally, the perturbed step number needs to be detected. If a word or phrase expressing negation or correction, such as "wrong," "incorrect," "error," or "invalid," appears together within a local text context, it is considered a perturbation recognized by the model and included in the scope of explicit correction. The continuation step that first matches the above explicit correction pattern can then be used to calculate the recovery latency.
[0097] (iii) Distribution sensitivity characteristics.
[0098] In embodiments of the present invention, the distribution sensitivity descriptor includes the answer-level log probability difference, the continuation-level confidence difference, the local negative log-likelihood shift, and the continuation length bias, the specific calculation methods of which are described in detail below.
[0099] For ease of description, let's assume... The logarithmic probability, representing the average probability per word in the main reasoning model, can be used to calculate both the logarithmic probability difference at the answer level and the confidence difference at the continuation level. It should be noted that the base of all logarithms in this invention is 10, and the base for the logarithmic calculation in the above logarithmic probabilities is also set to 10.
[0100] The log-probability difference of the answer level is defined as the counterfactual candidate answer. Compared with the original candidate answers The expression for the difference in the average logarithmic probabilities of the lexical units is:
[0101]
[0102] In the formula: Counterfactual candidate answer According to the average logarithmic probability of the word unit, Original candidate answers The input problem is represented by the average log probability of the tokens.
[0103] The confidence difference in continuation level is defined as counterfactual continuation. Continued from the original The expression for the difference in the average logarithmic probabilities of the lexical units is:
[0104]
[0105] In the formula: To continue writing counterfactual According to the average logarithmic probability of the word unit, To continue writing the original The input problem is represented by the average log probability of the tokens.
[0106] The local negative log-likelihood offset is defined as the difference between the negative log-likelihood of the counterfactual continuation and the original continuation within a preset quantifier range at the beginning of the continuation. Its expression is:
[0107]
[0108] In the formula: The negative log-likelihood is a continuation of the counterfactual expression. The expression represents the negative log-likelihood of the original continuation, where x represents the input problem; k represents the preset number of tokens included in the calculation of the beginning of the continuation, i.e., the above expression is calculated on the first k tokens of the beginning of the continuation, and the value of k can be adjusted according to the actual situation. In the embodiment of the present invention, k=30.
[0109] The continuation length deviation is defined as the length of the continuation based on counterfactual events. Length of the original continuation The degree to which the ratio deviates from 1 is the independent variable, calculated using a monotonically decreasing kernel function, and its expression is:
[0110]
[0111]
[0112] in Scalar kernel parameters to control the penalty intensity for deviations from the original continuation length.
[0113] Therefore, the above-mentioned answer-level log probability difference, continuation-level confidence difference, and local negative log-likelihood shift are calculated from the word log probability of the subject reasoning model; the continuation length bias is calculated from the ratio of the counterfactual continuation length to the original continuation length, and does not directly depend on the log probability.
[0114] Finally, based on the above result sensitivity descriptor, propagation sensitivity descriptor, and distribution sensitivity descriptor, integrating these three types of sensitivity descriptors yields the complete original sensitivity descriptor vector:
[0115]
[0116] S4. Feature Preprocessing and Weighted Aggregation: Each sensitivity descriptor is mapped and converted into sensitivity features, and the sensitivity features of each original inference path for the same input question are normalized on each feature dimension. Then, for each original inference path, the normalized sensitivity features are linearly combined using a pre-calibrated feature weight vector to obtain the path score of each original inference path, and further converted into voting weights using a normalized exponential function with a temperature parameter. Finally, the candidate answers of each original inference path are weighted and majority voted according to the voting weights to determine the final answer.
[0117] It should be noted that the mapping function described above, which converts each sensitivity descriptor into a sensitivity feature, can be designed according to the semantics of each descriptor itself. Its function is to transform the original descriptors into feature representations suitable for path scoring. This mapping process can be expressed as:
[0118]
[0119] in: The direction mapping function is predetermined based on the semantic features. The direction mapping only changes the numerical representation of the descriptor, without changing the original path and the counterfactual path itself.
[0120] In embodiments of the present invention, due to The actual descriptor dimension is 9, therefore the orientation mapping function In practice, it is necessary to design a feature direction transformation function suitable for each descriptor dimension. The specific transformation methods for each dimension are as follows:
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130] The final result is a sensitivity feature composed of 9 dimensions. .
[0131] Subsequently, for each original inference path within the same input question, the sensitivity features were analyzed on each sensitivity feature dimension. Normalization is performed to obtain the normalized feature representation. Then based on the linear feature weight vector Path scores are obtained through linear combinations:
[0132]
[0133] Path fractional temperature parameters The normalized exponential function is converted into voting weights:
[0134]
[0135] The final answer is obtained by weighted self-consistency:
[0136]
[0137] like Figure 3 The diagram illustrates an exemplary weighted self-consistency computation process. Assuming a total of four inference paths are sampled, after weighted self-consistency computation, the candidate answers corresponding to the four inference paths are... , , , Each calculated its own weight, where The highest, therefore choose As the final answer .
[0138] It should be noted that the candidate answers for the original path are the ones participating in the vote. rather than a counterfactual answer Counterfactual paths are only used for estimating weights. .when If all path scores are the same, this invention degenerates into standard self-consistency; therefore, the temperature parameter in the weighted self-consistency of this invention should be controlled. .
[0139] In an embodiment of the present invention, the linear feature weight vector Temperature parameters Kernel parameters of continuation length deviation The calibration is determined and fixed on a reserved calibration set. This calibration is used only to combine predefined sensitivity features, without training external validators, reward models, or step-level scorers, without changing the form of feature functions, without modifying the sampling path, and without altering counterfactual editing and continuation.
[0140] It should be noted that the core of the method described above in this invention does not lie in generating new answer candidates, but in more reliably aggregating existing sampled paths. Counterfactual editing, main model continuation, and sensitivity features all serve path weight estimation; the final output still comes from the weighted voting of the original path candidate answers. Counterfactual paths do not directly participate in the final answer voting. The purpose of using counterfactual paths in this invention is to obtain the sensitivity signal of each original inference path under local perturbation and to transform these signals into the voting weight of that original path. Therefore, this invention differs from training-phase enhancement, search-based generation, or external validator reordering methods; it belongs to the reliability-aware aggregation method in the inference phase.
[0141] It should be noted that the method steps shown in S1 to S4 above can essentially be implemented in the form of computer programs or software functional modules.
[0142] Therefore, based on the same inventive concept, such as Figure 4As shown, the present invention also provides a large model inference path aggregation system based on counterfactual path sensitivity, corresponding to the large model inference path aggregation method based on counterfactual path sensitivity provided in the above embodiments, which includes:
[0143] The path sampling module is used to sample multiple original reasoning paths from the main reasoning model for the input question. Each original reasoning path contains a reasoning process and its corresponding candidate answer.
[0144] The local counterfact detection module is used to perform local counterfact replacement on the target segment within an intermediate reasoning step for each original reasoning path. The replaced intermediate reasoning step and all the reasoning steps before it are used as the edited prefix. The main reasoning model then generates a counterfact continuation based on the edited prefix to obtain a counterfact reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, rather than the candidate answer itself, and does not belong to the conditions explicitly given in the input question.
[0145] The sensitivity descriptor extraction module is used to extract sensitivity descriptors that characterize the differences between each pair of original reasoning paths and counterfactual reasoning paths. The sensitivity descriptors include outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors.
[0146] The path scoring module is used to map the sensitivity descriptor to feature representation for each of the original inference paths, calculate the voting weight, and then perform weighted aggregation of the candidate answers for each original inference path to obtain the final output answer.
[0147] Furthermore, based on the same inventive concept, such as Figure 5 As shown, the present invention also provides a computer electronic device corresponding to the large model reasoning path aggregation method based on counterfactual path sensitivity provided in the above embodiments, which includes a memory and a processor;
[0148] The memory is used to store computer programs;
[0149] The processor is configured to implement the large model inference path aggregation method based on counterfactual path sensitivity as described above when executing the computer program.
[0150] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0151] Therefore, based on the same inventive concept, the present invention provides a computer-readable storage medium corresponding to the large model reasoning path aggregation method based on counterfactual path sensitivity. The storage medium stores a computer program, which, when executed by a processor, can realize the large model reasoning path aggregation method based on counterfactual path sensitivity as described above.
[0152] Therefore, based on the same inventive concept, the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, can realize the large model reasoning path aggregation method based on counterfactual path sensitivity as described above.
[0153] Specifically, in the computer-readable storage medium of the above three embodiments, the stored computer program is executed by a processor, which can perform the aforementioned steps S1 to S4.
[0154] It is understood that the aforementioned storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Furthermore, the storage media may also be various media capable of storing program code, such as USB flash drives, external hard drives, magnetic disks, or optical discs.
[0155] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0156] It should also be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the embodiments provided in this application, the division of steps or modules in the system and method is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules or steps may be combined or integrated together, and a module or step may also be split.
[0157] The present invention will further demonstrate the detailed implementation process and technical effects of the large model inference path aggregation method based on counterfactual path sensitivity shown in steps S1 to S4 on a specific dataset through a specific embodiment, so as to facilitate understanding of the essence of the present invention.
[0158] Example
[0159] The steps in this embodiment are the same as those in the large model inference path aggregation method based on counterfactual path sensitivity shown in steps S1 to S4 above, and will not be repeated here. The main focus is on demonstrating the specific dataset, some specific parameter settings, and implementation results of this embodiment. For ease of description, the method shown in steps S1 to S4 will be referred to as the method of this invention below.
[0160] To verify the effectiveness of the method of this invention, this embodiment uses three open-source large language models, Qwen3-4B, Qwen3-8B, and Meta-Llama-3.1-8B-Instruct, which have been fine-tuned with instructions, as the main inference models, and uses four inference benchmarks: AIME24, AIME25, MATH500, and MMLU-Pro. For the Qwen3 model, its built-in thinking mode is disabled to maintain consistency in the prompt protocol; MMLU-Pro uses 5000 questions with a fixed random sample. In addition, to compare the effectiveness of the method of this invention horizontally, several comparison methods are introduced, including Standard Self-Consistency (SC), Inference-Aware Self-Consistency (RASC), and Confidence-Enhanced Self-Consistency (CISC). All methods apply to the same set of sampling paths, only the aggregation rules differ. The path budget N takes the values {5, 10, 15, 20}, where N is the number of original inference paths sampled by the main inference model for a single input question.
[0161] In this embodiment, the original paths are generated by the principal inference model under the same sampling configuration. SC, RASC, CISC, and the method of this invention all use the same path pool, so the differences arise from the path aggregation rules. The method of this invention performs a local counterfactual probe once on each path and transforms the response differences between the original path and the counterfactual path into voting weights.
[0162] In this embodiment, if the path contains at least two steps, then the intervention steps are uniformly taken as... The auxiliary editing module, implemented in this embodiment by GPT-4o-mini, is used to generate local fragment replacements. The main inference model continues from the edit prefix and extracts the nine-dimensional sensitivity features. For MATH500 and MMLU-Pro, the aggregation rules determine the parameters on a fixed reserved calibration subset under each model-dataset-budget setting, and then apply them to the corresponding test subset.
[0163] In this embodiment, the auxiliary editing module only instantiates local fragment replacements and does not read other sampling paths, truth labels, or verification results. Its output, after fragment matching and format verification, is used to construct the editing prefix. The main reasoning model continues to generate counterfactual continuations after the editing prefix. Subsequent answer flipping, propagation statistics, and distribution statistics are all calculated based on the pairing of the original path and the counterfactual path. The experimental results of the method of this invention on various models and benchmarks are shown in Table 1:
[0164] Table 1. Experimental results of the present invention on various models and benchmarks (accuracy, %)
[0165]
[0166] As shown in Table 1, in 48 main experimental settings, the method of this invention achieves higher accuracy than the standard self-consistency method in 46 settings, and is on par in the remaining 2 settings. Compared with weighted self-consistency methods such as RASC and CISC, the method of this invention achieves superior or comparable superior results in 41 settings. The improvement is more significant in short-path-budget scenarios, while remaining stable in larger-scale evaluations such as MATH500 and MMLU-Pro.
[0167] To demonstrate whether counterfactual features provide effective information distinct from the original path likelihood, feature grouping ablation was performed under MATH500, Qwen3-8B, and N=15 settings. In the feature grouping ablation experiment, each group used the same original inference path, counterfactual editing results, and counterfactual continuation, only changing the feature subset used for path scoring. The Clean-only variant used only the original path log probability; the Logprob-CF variant used only three distribution sensitivity features: answer-level log probability difference (ALP), continuation-level confidence difference (CCG), and local negative log-likelihood offset (ΔNLL); the Text-CF variant used only five features directly extracted from the counterfactual continuation text: answer flip (AF), error absorption rate (EUR), original fragment citation rate (PRR), propagation coverage (PC), and recovery delay (RL); the Text-CF+CLD variant further added continuation length bias (CLD) to the five text features of the Text-CF variant. The full CPS simultaneously used the above sensitivity features. The nine sensitivity features were analyzed. The final ablation experiment results are shown in Table 2, where ΔSC represents the accuracy gain relative to the standard self-consistent SC.
[0168] Table 2. Characteristic grouping ablation (MATH500, Qwen3-8B, N=15)
[0169]
[0170] Table 2 shows that the complete CPS achieved an accuracy of 87.4%, which is 1.8 percentage points higher than the standard self-consistency. The counterfactual text features alone and the variants after adding continuation length bias also exceeded the baseline of the original path log probability alone, indicating that the counterfactual response is complementary to the original observation signal.
[0171] Further feature ablation using leave-one-out method was performed (each time only one of the sensitivity features was removed, and the rest were retained). The results are shown in Table 3, where ΔFull represents the impact of removing a single feature on the accuracy of the complete CPS.
[0172] Table 3. Characteristic ablation methods with one ablation point remaining (MATH500, Qwen3-8B, N=15)
[0173]
[0174] Table 3 shows that removing propagation coverage, error absorption rate, or answer flipping results in a significant decrease, while the remaining features also provide smaller but complementary contributions. This indicates that the method of this invention does not rely on a single dominant indicator, but rather integrates multiple sensitivity signals for path weighting.
[0175] To examine the impact of path budget, dense budget scans of N∈[1,30] were further evaluated on MATH500 and MMLU-Pro on Qwen3-8B. The results are shown in Table 4. The peak value @N represents the highest accuracy improvement of CPS relative to SC when N is taken. For example, +3.60@2 means that the accuracy improvement of CPS relative to SC is the highest when N is taken as 2, and the peak improvement rate is +3.60.
[0176] Table 4. Gains of CPS relative to SC on N∈[1,30] (Qwen3-8B, percentage points)
[0177]
[0178] Table 4 shows that on both datasets, the method of this invention outperforms standard self-consistency at 29 out of 30 budget points, with the only point of parity occurring at N=1; the average gains are 1.66 and 2.48 percentage points, respectively. The gains are more concentrated in the low-budget region, but continue to improve positively in the high-budget interval N∈[21,30]. On MATH500, the method of this invention reaches 86.0% at N=4, comparable to SC's 85.8% at N=30; considering only the number of continuations of the main inference model, approximately 8 continuations are required at N=4, while SC requires 30 paths at N=30. This result demonstrates that the method of this invention has good path budget efficiency when path budget is limited.
[0179] The embodiments described above are merely some preferred implementations of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A method for aggregating reasoning paths in a large model based on counterfactual path sensitivity, characterized in that, include: S1. For the input question, multiple original reasoning paths are sampled by the main reasoning model. Each original reasoning path contains a reasoning process and its corresponding candidate answer. S2. For each original reasoning path, perform local counterfactual replacement on the target segment within an intermediate reasoning step. Use the replaced intermediate reasoning step and all previous reasoning steps as the edited prefix. Then, the main reasoning model generates a counterfactual continuation based on the edited prefix to obtain a counterfactual reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, not the candidate answer itself, and does not belong to the conditions explicitly given in the input question. S3. For each pair of original reasoning paths and counterfactual reasoning paths, extract sensitivity descriptors to characterize the differences between them. The sensitivity descriptors include outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors. S4. For all original inference paths, the sensitivity descriptor is mapped to a feature representation and the voting weight is calculated. Then, the candidate answers of each original inference path are weighted and aggregated to obtain the final output answer.
2. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S1, the sampled original inference paths share the same set of sampling configurations, and the inference process in each original inference path needs to be parsed into an ordered sequence of inference steps according to the preset parsing rules; when the number of inference steps in the inference process is not less than two, the second inference step is selected as the intermediate inference step where the target segment is located.
3. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S2, the local counterfactual replacement is performed by the auxiliary editing module based on the large language model and follows a constrained fragment replacement protocol. It only replaces the target fragments that already exist in the intermediate inference step, without adding, deleting, or rewriting the entire step, and verification is required after the replacement is completed. The constrained fragment replacement protocol includes one of single fragment replacement, locally consistent fragment replacement, and multi-fragment replacement, and multi-fragment replacement is only used as a fallback method when there are multiple non-contiguous target fragments in the intermediate inference step.
4. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S3, the result sensitivity descriptor includes an answer flip descriptor, which measures whether the counterfactual substitution has changed the candidate answer; if it has changed, it is set to 1, otherwise it is set to 0.
5. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S3, the propagation sensitivity descriptor includes error absorption rate, original fragment reference rate, propagation coverage, and recovery delay; The error absorption rate is the percentage of steps in all steps of counterfactual continuation that match counterfactual segments. The original fragment citation rate is the percentage of steps in all steps of the counterfactual continuation that match the original fragment. The propagation coverage is the number of continuation steps included in the counterfactual continuation; The recovery delay is the reciprocal of the step number in the counterfactual continuation process when the first counterfactual disturbance is matched, corrected, rolled back, or rejected.
6. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S3, the distribution sensitivity descriptor includes the answer-level log probability difference, the continuation-level confidence difference, the local negative log-likelihood shift, and the continuation length bias. The answer-level log probability difference is the difference between the log probabilities of the counterfactual candidate answer and the original candidate answer averaged per word. The continuation-level confidence difference is the difference between the log probabilities of the counterfactual continuation and the original continuation averaged per word. The local negative log-likelihood shift is the difference in negative log-likelihood between the counterfactual continuation and the original continuation within a preset number of words at the beginning of the continuation. The continuation length bias is calculated using the degree to which the ratio of the lengths of the counterfactual continuation and the original continuation deviates from 1 as the independent variable, through a monotonically decreasing kernel function.
7. The large-model inference path aggregation method based on counterfactual path sensitivity as described in claim 1, characterized in that, In S4, each sensitivity descriptor is mapped and converted into sensitivity features, and the sensitivity features of each original inference path for the same input question are normalized on each feature dimension. Then, for each original inference path, the normalized sensitivity features are linearly combined using a pre-calibrated feature weight vector to obtain the path score of each original inference path, and further converted into voting weights using a normalized exponential function with a temperature parameter. Finally, the candidate answers of each original inference path are weighted and majority voted according to the voting weights to determine the final answer.
8. A large-scale model reasoning path aggregation system based on counterfactual path sensitivity, characterized in that, include: The path sampling module is used to sample multiple original reasoning paths from the main reasoning model for the input question. Each original reasoning path contains a reasoning process and its corresponding candidate answer. The local counterfact detection module is used to perform local counterfact replacement on the target segment within an intermediate reasoning step for each original reasoning path. The replaced intermediate reasoning step and all the reasoning steps before it are used as the edited prefix. The main reasoning model then generates a counterfact continuation based on the edited prefix to obtain a counterfact reasoning path that matches the current original reasoning path. The target segment is an intermediate quantity or asserted sub-conclusion in the intermediate reasoning step, rather than the candidate answer itself, and does not belong to the conditions explicitly given in the input question. The sensitivity descriptor extraction module is used to extract sensitivity descriptors that characterize the differences between each pair of original reasoning paths and counterfactual reasoning paths. The sensitivity descriptors include outcome sensitivity descriptors, propagation sensitivity descriptors, and distribution sensitivity descriptors. The path scoring module is used to map the sensitivity descriptor to feature representation for each of the original inference paths, calculate the voting weight, and then perform weighted aggregation of the candidate answers for each original inference path to obtain the final output answer.
9. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it can implement the large model reasoning path aggregation method based on counterfactual path sensitivity as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to, when executing the computer program, implement the large model inference path aggregation method based on counterfactual path sensitivity as described in any one of claims 1 to 7.