A hallucination detection method in a large language model based on sparse autoencoder
By using a three-stage hallucination detection method based on sparse autoencoders, we have solved the problems of high computational cost and insufficient robustness in hallucination detection of large language models. This method achieves accurate and interpretable hallucination detection, meets the requirements of real-time detection, and improves cross-domain applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-03-19
- Publication Date
- 2026-06-12
AI Technical Summary
Existing hallucination detection methods based on large language models suffer from problems such as high computational cost, limited detection performance, insufficient robustness, and poor cross-domain generalization ability. Sparse autoencoders and dynamical systems and phase transition analysis have not been effectively applied to hallucination detection, making it difficult to meet the needs of practical applications.
A three-stage hallucination detection method based on sparse autoencoders is adopted, including phase transition region localization based on geometric potential energy, hallucination feature screening based on contrastive direct Logit attribution, and causal hallucination detection based on L1 regularized logistic regression probe. By quantifying the critical phase transition of the internal state of the model and the causal contribution of sparse features, accurate and interpretable hallucination detection is achieved.
It eliminates the need for multiple model forward propagation, reduces computational costs, improves detection robustness and accuracy, meets real-time detection requirements, can explain the illusion generation mechanism, and has strong cross-domain generalization ability.
Smart Images

Figure CN122196968A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of language model illusion detection technology, and in particular to an illusion detection method based on a sparse autoencoder in a large language model. Background Technology
[0002] Large Language Models (LLMs), with their outstanding emergent capabilities, are widely used in natural language generation, intelligent interaction, and knowledge-based question answering, becoming a core carrier for the practical application of artificial intelligence technologies. However, the illusion phenomenon in the model generation process—where generated content appears reasonable but does not conform to objective facts—severely restricts their application in high-risk, high-precision fields such as medicine and law, and also raises concerns about the reliability and interpretability of these models.
[0003] Existing hallucination detection methods for large language models are mainly divided into two categories: black-box detection methods and white-box detection methods. However, both have significant drawbacks and are difficult to meet the needs of practical applications.
[0004] Black-box detection methods treat the model as an impenetrable black box, relying solely on external features of the model's input and output for detection. The core idea is to judge content authenticity by the consistency of multiple generated outputs. Typical methods include Lexical Similarity (based on output text similarity), SelfCheckGPT (based on multiple version output verification), and CoVe. However, these methods suffer from several problems: extremely high computational cost, with multiple forward propagations significantly increasing inference time and failing to meet real-time detection requirements; lack of interpretability, only able to determine the presence of illusions, unable to explain the underlying mechanisms and root causes of errors; limited detection performance, relying only on surface statistical clues at the output layer, resulting in poor generalization across scenarios and domains; and susceptibility to the randomness of model generation, leading to misjudgments.
[0005] White-box detection methods utilize the internal state of the model for detection and are currently the mainstream research direction. They can be further divided into basic heuristic methods and advanced probe methods, but key technical bottlenecks remain. One approach uses single statistical features extracted from the model's internal structure as the basis for detection, such as perplexity, attention entropy, and activation statistics, using "uncertainty" as the criterion for hallucination judgment. However, this method has limited feature representation capabilities, is easily affected by the input scenario and question type, lacks robustness, and cannot be explained by attribution. Another approach trains specialized detection models on the model's internal features to achieve recognition, such as SAPALMA, HaloScope, and MHAD. While their detection performance is superior to basic heuristic methods, they still have many problems: ignoring the dynamic generation characteristics of hallucinations and analyzing the internal state from a static perspective results in the loss of temporal evolution information, leading to insufficient detection accuracy and timeliness; they are severely affected by neuronal polysemy, making it difficult to accurately isolate causal features, resulting in poor interpretability and easy introduction of interference; there is an imbalance between computational cost and detection efficiency, with high cost for full-layer feature detection and inability to capture core signals for some layers; and insufficient cross-domain generalization ability, easily overfitting the domain features of the training dataset, leading to performance degradation in cross-domain detection.
[0006] In the field of interpretability research for large language models, sparse autoencoders (SAEs), while capable of decoupling densely activated features and achieving unentangled representations of single features corresponding to single semantic concepts, have not yet been applied to hallucination detection, failing to address the problems of feature entanglement and attribution difficulties. Meanwhile, in the field of complex systems analysis, dynamical systems and phase transition analysis techniques have revealed critical phase transition characteristics in the hallucination generation process of models; however, existing detection techniques have not been researched based on this characteristic, and no dynamic detection framework has been established, making it difficult to capture the core mechanisms of hallucination generation. Summary of the Invention
[0007] The purpose of this invention is to provide a hallucination detection method for large language models based on sparse autoencoders, which solves the problems that existing black-box and white-box detection methods have defects and that auxiliary technologies such as sparse autoencoders, dynamic systems and phase transition analysis are not effectively applied to hallucination detection, making it difficult to meet the needs of practical applications.
[0008] To achieve the above objectives, this invention provides a method for hallucination detection in large language models based on sparse autoencoders, comprising the following steps: S1. Phase transition region localization based on geometric potential energy: quantify the hierarchical evolution of geometric potential energy (GPE) differences, locate the critical layer interval (i.e., phase transition region) where the internal state of a large language model transitions to illusion, and narrow the search space for subsequent analysis. S2. Screening of hallucination features based on contrastive direct Logit attribution: Within the phase transition region located in S1, the causal contribution of a single sparse feature to the hallucination output is quantified by contrastive direct Logit attribution C-DLA, and sparse features that play a core driving role in hallucination generation are screened out. S3. Causal hallucination detection based on L1 regularized logistic regression probe: Using the core hallucination features selected in S2 as input, an L1 regularized logistic regression probe is trained, and the trained probe is used to detect hallucinations in content generated by a large language model.
[0009] Preferably, the geometric potential energy (GPE) mentioned in S1 is used to quantify the degree to which the internal representation of the model deviates from the "correct sample attractor," and is defined as the squared Euclidean distance between the model and the centroid of the SAE feature in the SAE feature space. The calculation formula is as follows: ; in, Let the SAE feature centroids be the features of all fact samples. The SAE mapping result of the residual flow at step t of layer l is given. This index can capture the direction and magnitude of deviation at the semantic level and amplify significant phase transition deviations.
[0010] Preferably, the hierarchical evolution of the difference in quantized geometric potential energy (GPE) in S1 specifically includes: For each layer The average GPE difference between the hallucination samples and the factual samples is calculated as follows: ; in, and These represent the hallucination sample set and the fact sample set, respectively. Define relative growth rate Characterization The dynamics are expressed by the following formula: ; Locating the phase transition initiation layer To represent the earliest layer with three consecutive positive growth rates, the formula is: ; Positioning the phase transition end layer for exist ≥ The formula for the layer that reaches its maximum value within the range is: ; Determine the layer spacing [ , [ ] represents the phase transition region of the model.
[0011] Preferably, the calculation formula for the comparative direct Logit attribution C-DLA described in S2 is as follows: ; Where i is the sparse feature number. It is feature activation. It's the SAE decoder direction. It is to de-embedding the matrix. For illusion error token, This is a token that confirms the facts.
[0012] Preferably, the method for selecting the core driving sparse features in S2 is as follows: on the training sample set, calculate the sparse features of all sparse features within the phase transition region. The values are calculated and the average amplitude is obtained. The features are sorted in descending order according to the average amplitude, and a preset number of features are selected as the core hallucination driving features.
[0013] Preferably, the optimization objective for training the L1-regularized logistic regression probe in S3 is the L1-regularized cross-entropy loss, as shown in the formula: ; Where θ is the weight parameter of the probe. Here, λ represents the sample label, N is the number of training samples, and λ is the L1 regularization coefficient. For the sample The concatenated activation vector on the selected core illusion feature set T.
[0014] Preferably, in S3, hallucination detection is achieved using the trained probe, specifically including: Input the prompt to be detected into a large language model and extract the residual flow in the phase transition region; Sparse features are obtained by mapping the residual stream through a sparse autoencoder, and the activation values of the core hallucination-driven features are used to form an activation vector. Input the activation vector into the trained L1 regularized logistic regression probe and output the hallucination probability. If the probability of hallucination exceeds a preset threshold, the sample is marked as "Hallucination exists"; otherwise, it is marked as "Fact Generation".
[0015] Therefore, the present invention employs the aforementioned hallucination detection method in a large language model based on a sparse autoencoder, with the following technical effects: 1. Achieving interpretable origin of illusions: Sparse autoencoders map the model residual flow to an overcomplete sparse space, achieving a de-entangled representation of a single feature corresponding to a single semantic concept.
[0016] 2. Addresses the pain points of traditional black-box and white-box detection methods: Eliminates the need for multiple model forward propagation, avoiding high computational costs and long inference times, and meeting real-time detection requirements; abandons the single statistical feature detection approach, decouples the model from densely activated features through a sparse autoencoder, improves feature representation capabilities, and enhances detection robustness.
[0017] 3. Quantitative modeling of the hallucination generation mechanism: The generation process of LLM is modeled as a trajectory on the potential energy landscape, and the hallucination generation is corresponding to the critical phase transition of the internal dynamics of the model from the "low-energy fact state" to the "high-energy error state". The degree of deviation of the internal representation of the model from the "correct sample attractor" is quantified by GPE, thus realizing the quantification and capture of the core mechanism of hallucination generation. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the HalluSAE three-stage hallucination detection process of the present invention; Figure 2 This is a differential evolution diagram of the 42-layer GPE of Gemma-2-9B in this invention; Figure 3 This is an example image of a highly activated sample representing the core hallucination feature of this invention. Detailed Implementation
[0019] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0020] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0021] Example 1 This invention provides a hallucination detection method (HalluSAE) for large language models based on sparse autoencoders. Using Gemma-2-9B as the base model and implemented with the Gemma Scope sparse autoencoder SAE, the core process employs a three-stage workflow: phase transition region localization, hallucination feature attribution, and causal probe detection. This achieves accurate and interpretable detection of hallucinations in LLM-generated content. On the in-distribution dataset HaluEval, the area under the ROC curve reaches 92.86%, and on the out-of-distribution dataset TriviaQA, the area under the ROC curve reaches 80.44%, significantly outperforming existing baseline methods.
[0022] The sparse autoencoder uses Gemma Scope SAE to map the residual stream of the large language model LLM to a 131072-dimensional overcomplete sparse space (36.6 times overcomplete). The activation function is JumpReLU (balancing sparsity and activation strength). The average L0 sparsity of each layer is ≈30, and the average L0 sparsity of the phase transition region (L23-L35) is ≈31. The hook position of SAE is resid_post, and the reconstruction MSE is <0.01.
[0023] Sparse autoencoders will The residual flow of a dimension is mapped to a much higher-dimensional, sparse space. In this space, each dimension is encouraged to capture a single semantic concept. The SAE decomposition formula for residual flow is: ; in, Indicates the first Activation of sparse features, For the residual flow of the l-th layer at step t, , These are the encoding and decoding weights of SAE, respectively. This is the encoding bias.
[0024] Two complementary benchmark datasets were used, both of which underwent a double-labeling process of automatic GPT-4o annotation and human expert review. After removing ambiguous samples, a high-quality dataset was obtained. Specific statistics are shown in Table 1. Table 1
[0025] The core logic of this method is as follows: The generation process of LLM is modeled as a trajectory on a potential energy landscape. The generation of hallucinations corresponds to a critical phase transition in the model's internal dynamics from a "low-energy fact state" to a "high-energy error state." Through a three-stage analysis from coarse to fine, a closed loop is achieved for phase transition region localization, hallucination feature tracing, and causal detection. The overall process is as follows: Figure 1 As shown in the diagram, the hallucination detection process first uses a potential energy-based phase transition region localization method to perform coarse-grained screening of the input data, quickly identifying potential areas where hallucinations may exist. Then, using contrastive direct Logit attribution technology, these areas are further screened for fine-grained features, accurately identifying features with hallucination tendencies. Next, an L1 regularized logistic regression probe is used to further analyze and model the selected features to capture the causal relationship between features and hallucinations. Finally, based on the probe's output, a hallucination probability or a definitive detection conclusion is given, completing the entire hallucination detection process from coarse-grained localization to fine-grained attribution, and finally to causal judgment.
[0026] The first stage is phase transition region localization based on geometric potential energy. The goal of this stage is to locate the critical layer interval (phase transition region) where the internal state of the model transitions to illusion by quantifying the hierarchical evolution of geometric potential energy (GPE) differences. The core is to identify the layers where geometric potential energy grows exponentially, thereby narrowing the search space for subsequent analysis.
[0027] From a dynamical system perspective, GPE is used to quantify the degree to which the internal representation of the model deviates from the "correct sample attractor," and is defined as the squared Euclidean distance in the SAE feature space to the centroid of the SAE feature of the factual sample: ; in, Let the SAE feature centroids be the features of all fact samples. The SAE mapping result of the residual flow at step t of layer l is given. This index can capture the direction and magnitude of deviation at the semantic level and amplify significant phase transition deviations.
[0028] For each layer The average GPE difference between the hallucination samples and the factual samples is calculated as follows: ; in, and These represent the hallucination sample set and the fact sample set, respectively.
[0029] To characterize the dynamics of this difference, the relative growth rate is defined as: ; Stable or fluctuating This indicates that the model remains consistent, while a series of sustained positive growths suggests a shift towards illusion.
[0030] To robustly identify the onset of this transformation, we locate the earliest strata exhibiting three consecutive positive growth rates. Initial layer spacing [ , Determine the phase transition initiation layer: ; The finish line Defined as The layer that reaches its initial maximum value is the phase transition termination layer. ; By analyzing potential energy dynamics, this process allows us to automatically detect "phase transition regions"—the areas within the model where the state transitions most dramatically towards hallucination. The identified regions provide a fundamental basis for subsequent fine-grained analysis of the most vulnerable layers to hallucination.
[0031] In this embodiment, the L23-L35 regions of Gemma-2-9B (a total of 13 layers) were located as phase transition regions using the above method. The GPE difference in this region increased sharply from 5862 in L23 to 121245 in L35, an increase of 20.7 times. Cohen's d=1.64 (p<0.001), indicating a statistically significant phase transition. The evolution of the layer GPE difference is as follows: Figure 2 As shown.
[0032] Within the phase transition region (L23-L35) of the localization, the causal contribution of individual sparse features to the hallucination output is quantified by C-DLA, and the sparse features that play a core driving role in the generation of hallucinations are screened out, solving the problem of activation entanglement and inability to accurately trace the source in the original model.
[0033] Within the identified phase transition layer, a subset of SAE features is designed to isolate causally driven hallucinations. For each feature... We define it for the target token The direct Logit attribution is: ; Where i is the sparse feature number. It is feature activation. It's the SAE decoder direction. It is the embedding matrix. This quantifies the linear path from sparse features to their impact on the model output space.
[0034] However, hallucination generation is essentially a contrastive process: it depends not only on increasing the probability of incorrect tokens but also on suppressing the probability of correct tokens. To capture this, we introduce contrastive direct Logit attribution, defined as: ; in, For illusion error token, For a token that is factually correct, This represents the semantic direction from correct to incorrect in the output space. A positive value indicates that the feature simultaneously boosts incorrect tokens and suppresses correct tokens, making it the core feature driving the illusion.
[0035] Calculate the sparse features for all 131,072 features within the phase transition region (L23-L35) The average amplitude was calculated, and the features were sorted in descending order based on the average amplitude. The top 100 features (0.076% of the total features) were selected as the core hallucination driving features. The C-DLA contribution of these features showed a highly skewed Pareto distribution. The top 0.1% of features accounted for 41.1% of the total attribution, with a Gini coefficient of 0.912, which is much higher than the 0.414 of the random baseline, proving that a few features dominate the generation of hallucinations.
[0036] The high-purity hallucination-driving features selected in this embodiment are shown in Table 2. Each feature strongly corresponds to a specific hallucination type, such as numerical substitution or entity confusion. Examples of feature activation samples are shown below. Figure 3 As shown.
[0037] Table 2
[0038] Using the 100 core hallucination features selected in the second stage as input, an L1 regularized logistic regression probe is trained to establish a causal relationship between feature activation patterns and hallucination results, thereby achieving efficient and accurate hallucination detection during reasoning.
[0039] For each sample ,make Indicates the selected feature set Concatenated activation of all layers within the recognition region. A key feature set is constructed by selecting sparse features with the highest average C-DLA magnitude across the entire training dataset. Then, a single logistic regression probe is trained on these high-impact features to distinguish between illusions and fact generation.
[0040] The detection model was constructed as Regularized logistic regression optimizes the L1-regularized cross-entropy loss, with the following formula: ; Where θ is the weight parameter of the probe. Let N be the sample label (+1 for illusion, -1 for fact), N be the number of training samples, and λ be the L1 regularization coefficient (selected through 5-fold cross-validation). For the sample The concatenated activation vector on the selected core illusion feature set T.
[0041] In this embodiment, the optimal λ corresponds to a regularization strength C=0.1. The key configurations for probe training are shown in Table 3. Balanced class weights are used to balance the samples, and the features are standardized by StandardScaler (zero mean, unit variance). The solver is liblinear (optimized for L1 regularization and small datasets).
[0042] Table 3
[0043] For new input prompts, perform the following steps to complete the hallucination detection: The prompt will ask you to input Gemma-2-9B to extract the residual flow in the phase transition region (L23-L35); Sparse features were obtained through SAE mapping, 100 core hallucination features were selected, and activation vectors were constructed. Input the activation vector into the trained logistic regression probe and output the hallucination probability. If the probability of hallucination exceeds a preset threshold (0.5 in this embodiment), the sample is marked as "Hallucination exists"; otherwise, it is marked as "Fact Generation".
[0044] This method is compared with eight existing hallucination detection baselines (covering four paradigms: uncertainty, consistency, internal state, and supervisory probe) on HaluEval (in-distribution) and TriviaQA (out-distribution). AUC is the primary metric, while accuracy and recall are secondary metrics. The results are shown in Table 4. This method achieves state-of-the-art performance on all metrics.
[0045] Table 4
[0046] To verify the effectiveness of each stage of this method, ablation experiments were conducted on layer selection strategy, feature attribution method, and stage synergy.
[0047] The layer selection strategy ablates a fixed 100-dimensional feature budget. The performance of random layer, early layer, late layer, full layer and phase transition region layer is compared. The phase transition region layer (L23-L35) achieves the best ID AUC=93% and OOD AUC=80%, which is comparable to the full layer (420 features) but reduces the number of features by 4.2 times, proving the effectiveness of potential energy-based phase transition region localization. Figure 2 The hierarchical evolution of the GPE difference between hallucination and fact samples across all 42 layers was depicted. The trajectory reveals three distinct phases: a stable period (L0–22), characterized by near-zero energy difference and random fluctuations, indicating similar representational dynamics in early processing of hallucination and fact samples; a phase transition region (L23–35), marked by a sharp 20.7-fold increase in energy (from 5,862 in L23 to 121,245 in L35), representing a qualitative shift, such as the large effect size between the stable and transitional phases (Cohen's...). , This has been confirmed by [the relevant authorities]; and during the plateau period (L36–41), there was a sustained high but stable energy level (compared to Cohen's [other data]). , This indicates that a state of continuous deviation has been entered.
[0048] The feature attribution method was ablated by comparing Wrong-only DLA, Correct-only DLA, random selection, and C-DLA within the phase transition region. The feature purity of C-DLA reached 89% (far higher than other methods), as shown in Table 5. ID AUC=93% and OODAUC=80%, proving that contrastive attribution can accurately capture the causal features of hallucinations. Table 5
[0049] The stage-based synergistic ablation method improved the OOD AUC by 1.1% in the first stage alone, 15.0% in the second stage alone, and 17.4% in the combined stage, showing a synergistic gain of 1.4%. Two-way ANOVA showed that the interaction term was significant, proving the necessity of the three-stage coarse-to-fine design.
[0050] Therefore, this invention adopts the above-mentioned hallucination detection method in a large language model based on a sparse autoencoder. By modeling LLM hallucination as a critical phase transition process in the model's intrinsic dynamics, relying on the semantic features of the sparse autoencoder to deentangle the model's internal semantic features, and combining geometric potential energy measurement, comparative direct Logit attribution and L1 regularized logistic regression probes, a three-stage detection framework is designed and completed, which includes potential energy-based phase transition region localization, hallucination-related sparse feature attribution, and probe-based causal hallucination detection.
[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for hallucination detection in a large language model based on a sparse autoencoder, characterized in that, Includes the following steps: S1. Phase transition region localization based on geometric potential energy: quantify the hierarchical evolution of geometric potential energy (GPE) differences, locate the critical layer interval (i.e., phase transition region) where the internal state of a large language model transitions to illusion, and narrow the search space for subsequent analysis. S2. Screening of hallucination features based on contrastive direct Logit attribution: Within the phase transition region located in S1, the causal contribution of a single sparse feature to the hallucination output is quantified by contrastive direct Logit attribution C-DLA, and sparse features that play a core driving role in hallucination generation are screened out. S3. Causal hallucination detection based on L1 regularized logistic regression probe: Using the core hallucination features selected in S2 as input, an L1 regularized logistic regression probe is trained, and the trained probe is used to detect hallucinations in content generated by a large language model.
2. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 1, characterized in that, The geometric potential energy (GPE) described in S1 is used to quantify the degree to which the internal representation of the model deviates from the "correct sample attractor". It is defined as the squared Euclidean distance between the model and the centroid of the SAE feature in the SAE feature space, and the calculation formula is as follows: ; in, Let the SAE feature centroids be the features of all fact samples. The SAE mapping result of the residual flow at step t of layer l is given. This index can capture the direction and magnitude of deviation at the semantic level and amplify significant phase transition deviations.
3. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 2, characterized in that, The hierarchical evolution of the difference in quantified geometric potential energy (GPE) in S1 specifically includes: For each layer The average GPE difference between the hallucination samples and the factual samples is calculated as follows: ; in, and These represent the hallucination sample set and the fact sample set, respectively. Define relative growth rate Characterization The dynamics are expressed by the following formula: ; Locating the phase transition initiation layer To represent the earliest layer with three consecutive positive growth rates, the formula is: ; Positioning the phase transition end layer for exist ≥ The formula for the layer that reaches its maximum value within the range is: ; Determine the layer spacing [ , [ ] represents the phase transition region of the model.
4. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 1, characterized in that, The formula for calculating the direct Logit attribution C-DLA described in S2 is as follows: ; Where i is the sparse feature number. It is feature activation. It's the SAE decoder direction. It is to de-embedding the matrix. For illusion error token, This is a token that confirms the facts.
5. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 4, characterized in that, The method for selecting core driving sparse features in S2 is as follows: on the training sample set, calculate the sparse features of all sparse features within the phase transition region. The values are calculated and the average amplitude is obtained. The features are sorted in descending order according to the average amplitude, and a preset number of features are selected as the core hallucination driving features.
6. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 1, characterized in that, In S3, the optimization objective for training the L1-regularized logistic regression probe is the L1-regularized cross-entropy loss, as shown in the formula: ; Where θ is the weight parameter of the probe. Here, λ represents the sample label, N is the number of training samples, and λ is the L1 regularization coefficient. For the sample The concatenated activation vector on the selected core illusion feature set T.
7. The hallucination detection method in a large language model based on a sparse autoencoder according to claim 1, characterized in that, S3 utilizes trained probes to detect hallucinations, specifically including: Input the prompt to be detected into a large language model and extract the residual flow in the phase transition region; Sparse features are obtained by mapping the residual stream through a sparse autoencoder, and the activation values of the core hallucination-driven features are used to form an activation vector. Input the activation vector into the trained L1 regularized logistic regression probe and output the hallucination probability. If the probability of hallucination exceeds a preset threshold, the sample is marked as "Hallucination exists"; otherwise, it is marked as "Fact Generation".