Regulation and regulation question and answer illusion suppression fine tuning method based on anti-fact negative sample
By constructing counterfactual negative samples and training with evidence perception, and combining numerical consistency regularization and rejection decision-making, the problems of illusory answers and numerical errors in regulatory question-and-answer sessions are solved. The model achieves intelligent rejection and answer accuracy, and is suitable for question-and-answer scenarios with high accuracy requirements, such as legal provisions and technical standards.
Patent Information
- Application Number
- CN202511722722.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies for answering questions about rules and regulations suffer from problems such as generating illusionary answers, insufficient error identification capabilities, unintelligent rejection strategies, and a lack of numerical accuracy. In particular, when there is a lack of sufficient evidence or the quality of evidence is low, the model tends to generate fictitious answers, cannot effectively identify highly similar erroneous clauses, and lacks constraints on numerical accuracy.
We employ a fine-tuning method based on counterfactual negative samples. By constructing counterfactual samples with incorrect units, incorrect thresholds, and incorrect versions, and combining evidence-aware marginal maximization loss training, numerical consistency regularization, and a rejection decision mechanism, we construct a multi-dimensional feature rejection decision to ensure the traceability of answers and numerical accuracy.
It significantly improves the model's ability to suppress illusory answers, enhances its ability to distinguish erroneous information, achieves intelligent dynamic rejection and numerical accuracy, is suitable for regulatory question-and-answer scenarios with high accuracy requirements, and reduces business risks.
Smart Images

Figure CN121579672A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of artificial intelligence and natural language processing, and particularly relates to a regulation question and answer illusion suppression fine-tuning method based on counterfactual negative samples. BACKGROUND
[0002] With the wide application of large language models in various fields, retrieval-augmented generation (RAG) technology has become an important method to improve the accuracy and controllability of models. In the field of regulation question and answer, which requires high accuracy, the existing technology usually adopts the following process: first, the relevant evidence documents are recalled from the regulation clause library through the retriever, then the user query and the retrieved evidence are input into the large language model, and finally the answer based on the evidence is generated.
[0003] To optimize the performance of the model, the existing technology generally uses supervised fine-tuning or instruction fine-tuning to enable the model to learn to generate answers using context. In addition, researchers have also proposed strategies such as contrastive learning, confidence assessment based on retrieval scores, and simple refusal mechanisms to further improve the reliability of answers.
[0004] However, the existing technology has significant defects in practical application: First, the conventional fine-tuning method mainly relies on positive samples for training, resulting in the model still tending to generate "illusion" answers that appear smooth but are actually fictitious when there is a lack of sufficient evidence or the quality of the evidence is low, showing excessive confidence.
[0005] Second, the existing method cannot effectively distinguish between highly similar but key error information. For example, when dealing with numerical clauses, the model cannot reliably identify errors such as incorrect units (e.g., mistaking "kilovolt" for "ampere"), incorrect comparison thresholds (e.g., mistaking ">=" for ">"), or outdated old clauses, which can easily lead to serious business errors.
[0006] Third, the existing refusal strategy relies on fixed thresholds or a single confidence score, and does not link with multi-dimensional risk features such as coverage, logical entailment strength, and timeliness, making it impossible to achieve intelligent and dynamic refusal decisions in high-risk scenarios.
[0007] Fourth, when generating numerical assertions, the model lacks effective numerical constraint mechanisms, which can easily lead to problems such as inconsistent units and numerical replication bias, because the model treats numbers and units as independent language symbols without establishing physical connections and precise replication constraints between them.
[0008] The root cause of the above problems is that existing fine-tuning methods lack systematic utilization of high-quality, difficult negative samples; the confidence assessment mechanism is too crude; and there is a lack of a strong constraint generation mechanism for numerical accuracy and evidence traceability.
[0009] Therefore, there is an urgent need in this field for a fine-tuning method that can systematically suppress hallucinations, improve discrimination ability, and ensure numerical accuracy. Summary of the Invention
[0010] The purpose of this invention is to overcome the aforementioned shortcomings of existing retrieval enhancement generation techniques in regulatory question-and-answer formats, and to provide a method for fine-tuning illusion suppression based on counterfactual negative samples. Specifically, this invention aims to: 1. To address the problem of models generating overconfident outputs when there is a lack of sufficient evidence or the quality of evidence is low, a fine-tuning method is provided that can reliably refuse to answer in scenarios with no evidence or weak evidence. 2. To address the problem that existing methods cannot effectively identify highly similar erroneous clauses, and to improve the model's ability to make precise judgments on "approximately correct" information such as erroneous units, erroneous thresholds, and erroneous versions; 3. To address the disconnect between existing rejection strategies and specific task risks, establish a dynamic rejection decision-making mechanism based on multiple dimensions such as evidence strength, coverage, and timeliness; 4. Resolve the issues of inconsistent unit dimensions and inaccurate numerical replication in numerical assertions, ensuring the numerical accuracy and physical consistency of the generated answers.
[0011] To solve the above-mentioned technical problems, the present invention is implemented as follows: This invention provides a method for fine-tuning the suppression of illusions in rule and regulation question-and-answer sessions based on counterfactual negative samples, comprising the following steps: Step S1, Constructing Counterfactual Negative Samples: Based on the user query questions, correct answer labels, and correct evidence sets in the training samples, construct three types of counterfactual negative samples: incorrect units, incorrect thresholds, and incorrect versions. Step S2, training of marginal maximization loss for evidence perception: Based on the consistency scoring function, the marginal maximization loss function is used to widen the scoring gap between correct evidence and counterfactual evidence, and evidence strength weights are introduced for weighted training. Step S3, Numerical Consistency Regularization: Extract the numerical-unit set from the generated answer and evidence, perform unit normalization, and constrain the consistency between the numerical value and the evidence through the numerical consistency regularization function and the replication preference regularization. Step S4, Rejection Head and Temperature Calibration: Construct a rejection decision mechanism based on multi-dimensional features, calculate the rejection probability, and optimize the model confidence calibration through temperature calibration; Step S5, Controlled Generation and Citation Compliance: Attach precise citation tags during the answer generation process and penalize assertions that do not cover the evidence span to ensure the traceability of the answer.
[0012] Furthermore, it also includes: S6, Comprehensive training objective optimization: The marginal maximization loss, numerical consistency regularization loss, rejection head loss, and replication preference regularization loss are weighted and combined into a comprehensive training objective function, and KL divergence conformal constraint can be optionally added.
[0013] Furthermore, it also includes: Step S7, multi-step reasoning process: During online reasoning, calculate the retrieval margin, coverage, implication and composite confidence to determine whether the rejection conditions are met; if they are met, output the rejection template; otherwise, perform controlled generation and insert reference tags, and finally perform numerical consistency and timeliness checks.
[0014] Furthermore, in step S1, when constructing a counterfactual sample with incorrect units, the error in dimensionality or proportion is achieved by replacing the units or values in the value-unit pair; when constructing a counterfactual sample with incorrect thresholds, the error is achieved by changing the comparison relationship or perturbing the values; when constructing a counterfactual sample with incorrect versions, valid clauses are replaced with expired clauses based on the clause version diagram.
[0015] Furthermore, in step S4, the rejection decision mechanism uses the aforementioned multidimensional features as input and calculates the rejection probability through a neural network. When the rejection probability exceeds a preset threshold or the composite confidence level is lower than the minimum value, a rejection is triggered.
[0016] Furthermore, it also includes a difficult example mining mechanism, used to extract the highest-scoring sample from counterfactual negative samples as a difficult negative sample; and / or a cost-aware rejection mechanism, which injects business risk weights into the rejection threshold.
[0017] Furthermore, it also includes a tiered temperature control mechanism, which uses a lower temperature for numerical tokens to suppress digital jitter and a higher temperature for non-numerical tokens to maintain generation diversity.
[0018] Furthermore, the method described is applicable to regulatory question-and-answer scenarios with high accuracy requirements, such as legal provisions, technical standards, and safety specifications, and is used to suppress model illusions and ensure the correctness of numerical values and units.
[0019] Compared with the prior art, the advantages of this invention are as follows: (1) Significantly improve the ability to suppress hallucinations: By systematically constructing highly difficult counterfactual negative samples and combining them with marginal training of evidence perception, the model can form a strong discriminative power against “approximate but wrong” information, which fundamentally reduces the generation of hallucination answers.
[0020] (2) Ensure the accuracy of numerical answers: Through the unit dimension consistency constraint and numerical replication preference mechanism, the problem of numerical and unit generation errors is fundamentally solved, which is particularly suitable for engineering fields such as power and machinery that have strict requirements for numerical accuracy.
[0021] (3) Achieve intelligent dynamic rejection: The rejection header and temperature calibration mechanism, which integrate multi-dimensional features, overcome the limitations of the fixed threshold method, enabling the model to accurately perceive risks and proactively and reliably reject responses when evidence is insufficient or unreliable, thus greatly reducing business risks.
[0022] (4) Enhance the traceability and compliance of answers: The controlled generation and precise citation tagging mechanism ensures that every key assertion is verifiable. Combined with post-generation verification, a closed-loop guarantee of answer accuracy is formed, which improves the credibility and practicality of the system.
[0023] (5) It has good engineering applicability: The present invention adopts a modular design and can be seamlessly integrated into the existing RAG system as a plug-in. It has low computational overhead and is easy to deploy. It has important technical value and social and economic benefits in scenarios such as intelligent legal affairs, engineering consulting, and compliance review. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 A flowchart of the regulatory question-and-answer hallucination suppression fine-tuning method based on counterfactual negative samples provided by the present invention; Figure 2 This is one of the hardware structure diagrams of the electronic device provided in the embodiments of the present invention; Figure 3 This is the second schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] The terms "first," "second," etc., used in this specification are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class, without limiting the number of objects; for example, the first object can be one or more. Furthermore, in the specification, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0027] Please see Figure 1 As shown, this embodiment of the invention provides a method for fine-tuning the suppression of illusions in rule and regulation question-and-answer sessions based on counterfactual negative samples, including the following steps: Step S1, Constructing Counterfactual Negative Samples: Based on the user query questions, correct answer labels, and correct evidence sets in the training samples, construct three types of counterfactual negative samples: incorrect units, incorrect thresholds, and incorrect versions. Step S2, training of marginal maximization loss for evidence perception: Based on the consistency scoring function, the marginal maximization loss function is used to widen the scoring gap between correct evidence and counterfactual evidence, and evidence strength weights are introduced for weighted training. Step S3, Numerical Consistency Regularization: Extract the numerical-unit set from the generated answer and evidence, perform unit normalization, and constrain the consistency between the numerical value and the evidence through the numerical consistency regularization function and the replication preference regularization. Step S4, Rejection Head and Temperature Calibration: Construct a rejection decision mechanism based on multi-dimensional features, calculate the rejection probability, and optimize the model confidence calibration through temperature calibration; Step S5, Controlled Generation and Citation Compliance: Attach precise citation tags during the answer generation process and penalize assertions that do not cover the evidence span to ensure the traceability of the answer; Step S6, Comprehensive training objective optimization: The marginal maximization loss, numerical consistency regularization loss, rejection head loss, and replication preference regularization loss are weighted and combined into a comprehensive training objective function, and KL divergence conformal constraint can be optionally added; Step S7, multi-step reasoning process: During online reasoning, calculate the retrieval margin, coverage, implication and composite confidence to determine whether the rejection conditions are met; if they are met, output the rejection template; otherwise, perform controlled generation and insert reference tags, and finally perform numerical consistency and timeliness checks.
[0028] In step S1, when constructing a counterfactual sample with incorrect units, the error in dimensionality or proportion is achieved by replacing the units or values in the value-unit pair; when constructing a counterfactual sample with incorrect thresholds, the error is achieved by changing the comparison relationship or numerical perturbation; when constructing a counterfactual sample with incorrect versions, valid clauses are replaced with expired clauses based on the clause version diagram.
[0029] In step S4, the rejection decision mechanism uses the aforementioned multidimensional features as input and calculates the rejection probability through a neural network. When the rejection probability exceeds a preset threshold or the composite confidence level is lower than the minimum value, a rejection is triggered.
[0030] Furthermore, the method provided by this invention also includes a hard example mining mechanism for mining the highest-scoring sample from counterfactual negative samples as a hard negative sample; and / or a cost-aware rejection mechanism for injecting business risk weights into the rejection threshold.
[0031] The method also includes a tiered temperature control mechanism that uses a lower temperature for numerical tokens to suppress digital jitter and a higher temperature for non-numerical tokens to maintain generation diversity.
[0032] The method described is applicable to regulatory question-and-answer scenarios with high accuracy requirements, such as legal provisions, technical standards, and safety specifications, and is used to suppress model illusions and ensure the correctness of numerical values and units.
[0033] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0034] Example 1 Please combine Figure 1 As shown, this embodiment 1 provides a method for fine-tuning the suppression of illusions in rule and regulation question-and-answer sessions based on counterfactual negative samples, specifically including: Step S1: Constructing Counterfactual Negative Samples For the training sample set Three types of counterfactual negative samples were established, among which, This indicates that the user has a query question; Labels indicating the correct answer; This represents the correct set of evidence.
[0035] For counterfactual samples with incorrect units, correct evidence will be used. Numerical-unit pairs Replace with Dimensional error passed. To achieve, among which, For unit-dimensional mapping functions (e.g., replacing kilovolts (kV) with amperes (A) in error); for proportional errors, keep the dimensions the same. However, the conversion factor was incorrect, resulting in... ,in, The conversion factor is used for unit conversion (improper use of the conversion factor can lead to numerical errors even when the units are the same).
[0036] For counterfactual samples with incorrect thresholds, the comparison relationship can be changed. , and numerical perturbations Implementation, in which The range is 1-10% depending on the magnitude of the numerical value. The counterfactual samples generated by numerical perturbation may appear similar but contain critical business errors, such as changing "voltage greater than or equal to 380V" to "voltage greater than 380V" or "voltage greater than or equal to 400V". These seemingly minor changes can have serious consequences in practical applications.
[0037] For counterfactual samples with incorrect versions, use the clause version diagram. Replace the currently valid terms with expired terms. When time constraints The version of evidence in question has expired at the current query time. As evidence The valid time range (for example, if the current query time is 2024 and a clause that was repealed in 2020 is cited, then that version is invalid).
[0038] Counterfactual construction preserves the semantic context of the original text, including the subject, behavior, and conditions, and generates corresponding false assertions. (Incorrect answer from the unit) (Incorrect numerical answer) (Incorrect answer in this version) Maximize text similarity to increase the difficulty of discrimination.
[0039] Step S2: Marginal maximization loss of evidence perception Define a generative model for query-evidence-answer triples. Consistency scoring function Log-likelihood is used to measure the degree of match between the answer and the query given evidence. Or it can be achieved using a dedicated discrimination head.
[0040] The marginal maximization objective function is used to explicitly widen the score distance between correct and incorrect answers: ; in, It is the marginal loss function, representing the cumulative marginal violations across all triples. Specifically, This measures the deviation of the score gap between correct and incorrect triples from the target margin. When the score of the correct sample... Scoring of error samples The difference is less than the target interval When the difference is less than or equal to the target interval, a loss will occur; conversely, when the difference has met or exceeded the target interval, the loss is 0. Ensure that losses only occur when the interval is insufficient.
[0041] in Iterate through all (query, correct evidence, counterfactual evidence) triples in the training set. The interval parameter defines the minimum rating interval between correct and incorrect samples (usually...). ), For the correct triplet score, The score for the counterfactual error triple.
[0042] To highlight the risk of weak evidence, a weighting of evidence strength is introduced. ,in The coverage metric measures the extent to which counterfactual evidence covers the elements of the answer. The implication index measures the strength of the logical implication of evidence for the answer. The timeliness indicator function returns 1 if the query time is outside the evidence validity period, and 0 otherwise. The weighted loss function is: ; in, Scoring of the correct sample; Scoring of counterfactual error samples; The weighting coefficient controls the degree of influence of the evidence strength weight.
[0043] For scenarios without evidence, construct a penalty loss for hallucination: ; in, This indicates all queries Expectations; The threshold parameter for hallucination punishment; This indicates an empty evidence set (i.e., the retriever does not return any evidence). This represents the assertive answers (including specific numerical values and judgments) generated by the model. This loss helps the model avoid producing overconfident assertive outputs when there is no evidence.
[0044] Step S3: Numerical Consistency Regularization Extracting numerical values from the generated answer - unit set and the numerical-unit set in the evidence Perform unit normalization to convert all values to a unified target unit. : , ,in, Unit conversion factor.
[0045] Numerical consistency regularization functions are primarily used to constrain the numerical values and units in the model-generated answers to be consistent with the corresponding numerical values and units in the evidence. This fundamentally solves the problems of inconsistent units and numerical deviations in numerical assertions, ensuring the accuracy and credibility of numerical values in regulatory and institutional Q&A. Its specific definition is: ; in, This is a numerical consistency regularization function that measures the overall consistency between all numerical-unit pairs in the answer and their corresponding numerical-unit pairs in the evidence. It comprehensively evaluates numerical accuracy and unit consistency by calculating the normalized distance between each numerical value in the answer and the most matching value in the evidence. A smaller value indicates better consistency between the numerical values and units in the answer and the evidence; conversely, a larger value indicates greater bias. Minimizing this function during training guides the model to generate answers that are highly consistent with the evidence. The first term is the average of the total number of numerical-unit pairs in the answer. The difference in the value after penalty conversion This is a dimensional consistency indicator function. It returns 1 if the unit dimension of the numerical value in the answer is inconsistent with the unit dimension of the corresponding numerical value in the evidence; otherwise, it returns 0. The penalty weight is a unit of measurement.
[0046] Simultaneously enable copy preference regularization for numerical tokens: ; in, The replication preference regularization function measures the overall tendency of the model to replicate key values from the evidence. The set of all numerical tokens in the answer. Iterate through each numerical token in the answer. For the model in a given evidence span Under the condition of copying the token The probability of it is between [0,1]. The logarithm of this probability is within a certain range. When the negative sign is combined with the logarithmic function, This constitutes the cross-entropy loss; the higher the replication probability, the smaller the loss, and the lower the replication probability, the larger the loss. Summing over all numerical tokens yields... This is the sum of the replication losses for all numerical tokens. It is minimized during training. It can progressively enhance the model's ability to extract and reproduce key figures from evidence.
[0047] Step S4: Rejection head and temperature calibration Construct a rejection decision mechanism based on multidimensional features As input. The evidence score that ranks first in the retrieval marginal representation Compared to the second-ranked evidence score The difference, Coverage measures the proportion of key elements in candidate answers that are covered by evidence. To calculate the degree of logical implication of evidence to the answer, a natural language reasoning model is used. The percentage of expired clauses cited in the answer to the expiration rate statistics. The numerical conflict index calculates the number of numerical statements in the answer that are inconsistent with the evidence in terms of value or unit. The length of the answer is used as a proxy feature for the complexity of the answer.
[0048] The probability of rejection is calculated using a neural network: ,in It is the Sigmoid activation function. and These are the learnable weight vectors and bias terms.
[0049] The labeling strategy during training is as follows. Counterfactual negative samples refer to samples with incorrect units, incorrect thresholds, or incorrect versions constructed in S1. These negative samples will be labeled as "reject answer". No-evidence samples refer to query-answer pairs for which the model cannot retrieve any relevant evidence during the training data preparation phase. These samples are explicitly labeled and collected during dataset construction, representing questions in the system that cannot be answered using the evidence base. These no-evidence samples are also marked with a "refuse to answer" label. This allows the model to learn to proactively refuse to answer in scenarios lacking supporting evidence. Therefore, counterfactual negative samples and samples without evidence are both considered positive examples of "should be refused" in the supervised learning of the refusal head, and their labels are uniformly set as follows: Labeling positive samples with high composite confidence. The composite confidence level is defined as follows: ,in For weight parameters, The timeliness indicator function returns 1 to reduce confidence when the query time is outside the validity period of the evidence.
[0050] The training loss of the refusing head is ,in The cross-entropy loss function for binary classification is defined as follows: The calculation of the rejection head loss is used to train the rejection decision network to learn when to reject an answer, thereby enabling it to reliably identify scenarios with low confidence, insufficient evidence coverage, or inconsistencies in timeliness during inference.
[0051] Temperature calibration learns the temperature parameters by minimizing the expected calibration error (ECE) on the validation set. , ,in This represents the model's original predicted probability vector. This is the probability vector after temperature calibration. For the optimal temperature parameters ( The probability distribution is relatively flat. (The probability distribution is sharp at times). The role of temperature calibration is to optimize the confidence level of the model, so that its predicted probabilities better reflect the actual accuracy.
[0052] Step S5: Controlled Generation and Reference Compliance Attach precise citation tags to each key assertion. Key assertions are statements generated by the model that contain key business information such as specific numerical values, comparisons, and conditional judgments; these statements are generated along with the answer during the answer generation process. The citation tag format is: It contains structured information such as clause number, line number, period, character start and end positions, effective time, and expiration time.
[0053] During the decoding process of the fine-tuned large language model (i.e., the stage where the model generates answers token by token), the generation probability is readjusted to encourage citation compliance: ,in The penalty coefficient is... The function returns 1 if the assertion generated by the indicator function is not implied by any corresponding span of evidence, and 0 otherwise. When the assertion is sufficiently implied by evidence, the model outputs the answer with a complete citation label to ensure traceability. When the assertion is not implied by any evidence, the rejection mechanism is triggered, outputting a predefined rejection template "The conclusion cannot be determined under the current evidence; further review of relevant clauses [§ Candidate Clause List]" or rewritten as a conservative statement "Further review of relevant clauses is required".
[0054] Step S6: Training Objectives and Optimization Integrating the various components of the comprehensive training objective function: ; in, The objective function is the comprehensive training function, and the weighted summation is the sum of all loss terms. These are the weighting coefficients for each type of loss. This is the Kullback-Leibler divergence term, calculated during training. The output distribution of the model after fine-tuning. The output distribution of the pre-trained base model is used for conformal constraints to prevent excessive deviation from the base model.
[0055] The total loss is calculated to optimize multiple objectives such as hallucination suppression, numerical accuracy, rejection reliability, and citation compliance in a unified manner, so that the model can achieve a balance among these objectives.
[0056] The optimizer uses AdamW to efficiently minimize the aforementioned composite objective function. The learning rate is set to... Batch size is .
[0057] Step S7: Reasoning Process Online reasoning employs a multi-step decision-making process. First, relevant evidence is recalled and the retrieval margin is calculated. ,in The highest-ranked evidence retrieval score. The evidence retrieval score is the second highest; coverage is calculated. Implicability and composite confidence level .
[0058] Then determine the rejection condition: when or When this happens, a predefined rejection template is output: "This conclusion cannot be reached based on the current evidence. Further review of relevant clauses is recommended [§ Candidate Clause List]". The preset threshold for the probability of rejection is typically set to 0.5. The minimum threshold for composite confidence is usually set based on business tolerance.
[0059] Otherwise, controlled generation is performed (corresponding to the controlled generation and reference compliance strategy in step S5), inserting precise reference tags and applying numerical copy constraints during the decoding process. Finally, a post-generation verification is performed to confirm numerical consistency. and timeliness ,in The numerical value in the answer. The corresponding value in the evidence. The allowable numerical error threshold. For query time, This defines the valid time frame for the evidence. If the verification is successful, the answer is returned directly to the user. If the verification fails, such as a failure of the numerical consistency check or a failure of the timeliness check, the system will either reject the answer or provide a conservative statement that "further verification of the relevant clauses is required," without returning a potentially erroneous answer.
[0060] The above technical solutions, through a closed loop of "counterfactual construction - marginal training - numerical constraints - rejection decision - controlled generation - posterior verification", place the hallucination suppression capability and numerical accuracy on a unified and comparable evaluation framework, and achieve robust control over uncertain scenarios and high-risk assertions through explicit modeling of evidence strength.
[0061] Without departing from the purpose of this invention, there are equivalent alternatives to the related implementations: the interval parameter of the marginal loss. Adaptable Temperature calibration can be replaced by Platt calibration or isothermal regression; rejection features can be extended to dimensions such as semantic similarity and entity consistency; numerical regularization can be replaced by modeling based on relative error or percentiles. All of the above substitutions are within the scope of protection of this invention.
[0062] like Figure 2 As shown, this embodiment of the invention also provides an electronic device 600, which includes a processor 601, a memory 602, and a program or instructions stored in the memory 602 and executable on the processor 601. When the program or instructions are executed by the processor 601, they implement the various processes of the above-described embodiment of the rule and regulation question-and-answer illusion suppression fine-tuning method based on counterfactual negative samples, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0063] It should be noted that the first electronic device in the embodiments of the present invention includes the mobile electronic device and the non-mobile electronic device described above.
[0064] Figure 3 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present invention.
[0065] The electronic device 700 includes, but is not limited to, components such as: radio frequency unit 701, network module 702, audio output unit 703, input unit 704, sensor 705, display unit 706, user input unit 707, interface unit 708, memory 709, and processor 710.
[0066] Those skilled in the art will understand that the electronic device 700 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 710 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 3 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0067] It should be understood that, in this embodiment of the invention, the input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 706 may include a display panel 7061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 707 includes a touch panel 7071 and other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here. The memory 709 can be used to store software programs and various data, including but not limited to applications and operating systems. The processor 710 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understandable that the aforementioned modem processor may not be integrated into the processor 710.
[0068] This invention also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described embodiment of the rule and regulation question-and-answer illusion suppression fine-tuning method based on counterfactual negative samples, and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0069] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0070] This invention also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described embodiment of the rule and regulation question-and-answer illusion suppression fine-tuning method based on counterfactual negative samples, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0071] It should be understood that the chip mentioned in the embodiments of the present invention may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0072] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0073] Furthermore, it should be noted that the scope of the methods and systems in the embodiments of the present invention is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
[0074] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the scope of protection of the present invention, and all of these forms are within the protection scope of the present invention.
Claims
1. A method for fine-tuning the suppression of illusions in rule and regulation question-and-answer sessions based on counterfactual negative samples, characterized in that, Includes the following steps: Step S1, Constructing Counterfactual Negative Samples: Based on the user query questions, correct answer labels, and correct evidence sets in the training samples, construct three types of counterfactual negative samples: incorrect units, incorrect thresholds, and incorrect versions. Step S2, training of marginal maximization loss for evidence perception: Based on the consistency scoring function, the marginal maximization loss function is used to widen the scoring gap between correct evidence and counterfactual evidence, and evidence strength weights are introduced for weighted training. Step S3, Numerical Consistency Regularization: Extract the numerical-unit set from the generated answer and evidence, perform unit normalization, and constrain the consistency between the numerical value and the evidence through the numerical consistency regularization function and the replication preference regularization. Step S4, Rejection Head and Temperature Calibration: Construct a rejection decision mechanism based on multi-dimensional features, calculate the rejection probability, and optimize the model confidence calibration through temperature calibration; Step S5, Controlled Generation and Citation Compliance: Attach precise citation tags during the answer generation process and penalize assertions that do not cover the evidence span to ensure the traceability of the answer.
2. The method according to claim 1, characterized in that, Also includes: Step S6, Comprehensive training objective optimization: The marginal maximization loss, numerical consistency regularization loss, rejection head loss, and replication preference regularization loss are weighted and combined into a comprehensive training objective function, and KL divergence conformal constraint can be optionally added.
3. The method according to claim 1 or 2, characterized in that, Also includes: Step S7, multi-step reasoning process: During online reasoning, calculate the retrieval margin, coverage, implication and composite confidence to determine whether the rejection conditions are met; If satisfied, output the rejection template; Otherwise, controlled generation is performed and reference tags are inserted, followed by numerical consistency and timeliness checks.
4. The method according to claim 1, characterized in that, In step S1, when constructing a counterfactual sample with incorrect units, the error in dimensionality or proportion is achieved by replacing the unit or value in the value-unit pair. Constructing incorrect threshold counterfactual samples is achieved by changing the comparison relationship or numerical perturbation; When constructing a counterfactual sample with incorrect versions, valid clauses are replaced with expired clauses based on the clause version diagram.
5. The method according to claim 1, characterized in that, In step S4, the rejection decision mechanism uses the aforementioned multidimensional features as input and calculates the rejection probability through a neural network. When the rejection probability exceeds a preset threshold or the composite confidence level is lower than the minimum value, a rejection is triggered.
6. The method according to claim 1, characterized in that, It also includes a hard example mining mechanism, which is used to mine the highest-scoring sample from counterfactual negative samples as hard negative samples; and / or a cost-aware rejection mechanism, which injects business risk weights into the rejection threshold.
7. The method according to claim 1, characterized in that, It also includes a tiered temperature control mechanism that uses a lower temperature for numerical tokens to suppress digital jitter and a higher temperature for non-numerical tokens to maintain generation diversity.
8. The method according to claim 1, characterized in that, The method described is applicable to regulatory question-and-answer scenarios with high accuracy requirements, such as legal provisions, technical standards, and safety specifications, and is used to suppress model illusions and ensure the correctness of numerical values and units.
Citation Information
Cited By
Multi-modal fine-grained instruction fine-tuning data construction method based on reverse verification
CN121835802A