Method for reducing large model illusion problem based on RAG technology

By combining multi-source heterogeneous hypergraph structure and graph attention network, the problem of hallucination phenomenon in RAG technology is solved, accurate retrieval and causal consistency control of generated content are achieved, and the accuracy and credibility of generated content are improved.

CN120633859APending Publication Date: 2025-09-12华电(海西)新能源有限公司
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202510755056.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing RAG technology suffers from hallucinations in large-scale language models, making it difficult to effectively retrieve accurate evidence content. It also lacks deep causal relationship testing and hallucination risk warning mechanisms, resulting in inaccurate generated content.

Method used

A multi-source heterogeneous hypergraph structure is combined with a graph attention mechanism. By extracting semantic entities, relation phrases and context features, a hypergraph structure is constructed, and the graph attention network and sequence perception network are used for encoding. Combined with the confidence scoring and causal consistency judgment modules, hallucination risk assessment and reverse retrieval mechanism are realized.

Benefits of technology

It effectively suppresses the hallucination phenomenon in the process of generating large models, improves the authenticity and credibility of the generated content, and shows better adaptability in fields such as medical care, law, and financial consulting that have high requirements for information accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120633859A_ABST
    Figure CN120633859A_ABST
Patent Text Reader

Abstract

The invention discloses a method for reducing a large model illusion problem based on an RAG technology, and the method comprises the steps: extracting semantic entities, relation phrases and context features in a natural language query, and constructing a multi-source heterogeneous hypergraph; fusing the graph structure and sequence context information by using a graph attention network and a sequence perception network to form unified semantic representation; evaluating the illusion risk based on the confidence score, the evidence coverage rate and the semantic deviation index, and triggering reverse retrieval and fusion reinforcement; and the content is generated through causal consistency discrimination feedback control. According to the method, the illusion phenomenon of the generation result is remarkably reduced, and the method is widely applied to the field of intelligent question answering and information retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence natural language processing technology, and in particular to a method for reducing large model hallucination problems based on RAG technology. Background Art

[0002] In recent years, large-scale pre-trained language model (LLM) technology has rapidly developed in the field of artificial intelligence, providing strong technical support for a wide range of applications, including natural language processing, intelligent question-answering, and text generation. Large-scale language models, such as the GPT series, are pre-trained on massive amounts of text data through self-supervised learning, endowing the models with powerful text generation and contextual understanding capabilities. This has led to significant application results in tasks such as machine translation, automatic summarization, sentiment analysis, and information retrieval, making them a mainstream natural language processing technology.

[0003] However, with the widespread deployment of large-scale language models in real-world applications, their inherent "hallucination" phenomenon has become increasingly prominent. Specifically, hallucination refers to the tendency of language models to generate false, misleading, or unfounded content that is inconsistent with real information during the text generation process. This phenomenon is particularly prominent in fields such as medicine, law, and financial consulting, where information accuracy is extremely important, significantly limiting the reliability and practical value of the models.

[0004] To address these issues, the Retrieval-Augmented Generation (RAG) technology has emerged in recent years. The core idea behind RAG technology is to introduce evidence or information fragments from external knowledge bases before or during the generation of answers by large models to guide the model generation process and ensure that the generated content is more reliable and accurate. The specific implementation generally includes two core steps: on the one hand, using the retrieval system to retrieve knowledge evidence related to the current input query from the external knowledge base; on the other hand, combining the retrieved knowledge evidence with the model generation process to form a hybrid generation strategy to improve the authenticity and credibility of the generated content.

[0005] Typical existing RAG technology implementations typically employ a semantic retrieval strategy based on vector similarity. This involves first mapping the external knowledge base and the input query into a continuous vector space, and then calculating the semantic similarity between the two to retrieve the evidence most relevant to the query. However, this simple retrieval strategy, relying solely on semantic similarity, often faces the following limitations: First, because it only considers semantic similarity and ignores the complex relationship structure between entities, it may not be able to effectively retrieve the most accurate evidence content. Second, during the context fusion stage, current mainstream fusion mechanisms typically rely on simple concatenation or attention mechanisms, making it difficult to fully consider the deep causal and semantic structural relationships between evidence and queries. Furthermore, existing RAG technology often lacks effective hallucination risk warning and dynamic correction mechanisms in practical applications. Once the model experiences hallucinations, it is difficult to effectively intervene and correct them, and the hallucination problem remains fundamentally unresolved.

[0006] In recent years, some studies have further proposed methods for retrieval enhancement generation assisted by knowledge graphs or graph neural networks (GNNs). These methods attempt to utilize the structured relational features of knowledge graphs during the model generation process to improve the accuracy of retrieval content and the rationality of generated results. However, traditional knowledge graphs usually only cover binary relationships and have difficulty depicting the multi-dimensional and complex relationships between entities in actual application scenarios. At the same time, traditional graph neural networks mainly focus on static structural relationships and pay insufficient attention to serialized dynamic semantic information. Therefore, how to more comprehensively and accurately represent and utilize high-order semantic relationships between entities and effectively integrate dynamic sequence information to more accurately retrieve evidence and effectively suppress hallucination phenomena in the content generated by large models remains a bottleneck that existing technologies urgently need to break through.

[0007] Therefore, how to provide a method based on RAG technology to reduce the large model hallucination problem is a problem that those skilled in the art urgently need to solve. Summary of the Invention

[0008] One purpose of the present invention is to propose a method for reducing the hallucination problem of large models based on RAG technology. The present invention adopts a method combining multi-source heterogeneous hypergraph structure with graph attention mechanism. By extracting semantic entities, relational phrases and context features in natural language queries, a node set and hypergraph structure containing semantic and time dimensions are constructed. The hypergraph structure and context information are embedded and encoded respectively using graph attention network and sequence perception network. A unified semantic representation is formed by fusion through feature alignment module. The hallucination risk of generated content is evaluated based on confidence score, evidence coverage and semantic deviation index. When the risk exceeds the set threshold, the reverse retrieval mechanism is triggered to perform secondary retrieval reinforcement. The causal consistency between the generated content and the retrieved evidence is judged through the causal consistency judgment module, and then the generation path or local content is regulated by feedback, thereby achieving the goal of effectively suppressing the hallucination phenomenon in the process of large model generation, and having the technical effect of improving the authenticity and credibility of the generation results.

[0009] A method for reducing the large model hallucination problem based on RAG technology according to an embodiment of the present invention is characterized by comprising the following steps:

[0010] S1. Under the RAG architecture, receive natural language queries input by users, extract semantic entities, relation phrases and context features, and construct a structured set of entity nodes, relation nodes and context nodes;

[0011] S2. Based on entity co-occurrence, semantic relevance, and context sequence dependency, a high-order semantic coupling relationship is established between nodes to generate a multi-source heterogeneous hypergraph structure containing hyperedges in semantic and temporal dimensions.

[0012] S3, respectively uses the graph attention network to encode the hypergraph structure, uses the sequence perception network to model the context, and fuses them into a unified semantic representation vector through the feature alignment module;

[0013] S4. Before or during model generation, evaluate the consistency between the output semantic state and the retrieved evidence, and determine whether there is a risk of hallucination based on the confidence score, evidence coverage, and semantic bias indicators;

[0014] S5. When the hallucination risk is higher than the set threshold, the reverse retrieval mechanism is triggered to re-retrieve relevant evidence nodes in the hypergraph based on the current semantic state and fuse the reinforced semantic representation;

[0015] S6. The causal consistency judgment module determines the consistency of the causal chain between the generated content and the supporting evidence. If they are inconsistent, the generation path or local content is adjusted through the feedback mechanism.

[0016] S7. Output the final model response result after hallucination judgment, evidence enhancement and causal consistency control optimization.

[0017] Optionally, the S1 includes:

[0018] S1.1. Receive a natural language query text Q input by the user, and extract a semantic entity set E = {e1, e2, ..., e m}、Relational phrase set R={r1,r2,…,r n} and context feature set C = {c1, c2, ..., c k};

[0019] S1.2. Perform vector embedding on the sets E, R, and C respectively, and define the entity embedding function as f e (·), the relation embedding function is f r (·), the context embedding function is f c (·), calculate the entity embedding matrix H E , relation embedding matrix H R and the context embedding matrix H C , specifically expressed as:

[0020]

[0021] Among them, m, n, and k represent the number of elements in the sets E, R, and C respectively;

[0022] d1, d2, and d3 are the dimensions of semantic entity, relation phrase, and context feature vector embeddings, respectively;

[0023] S1.3. The embedded entities, relationships and context nodes are unified into a structured node set V = E∪R∪C, and for each node v in the node set i ∈V assigns the corresponding type label t i ∈{type E , type R , type C}.

[0024] Optionally, the S2 includes:

[0025] S2.1, based on the node set V=E∪R∪C obtained in step S1, according to any two entity nodes e in the entity node set E, i 、e j The co-occurrence frequency between them defines the co-occurrence intensity function f co-occ (e i ,e j );

[0026] S2.2, according to any two relationship nodes r in the relationship node set R i 、r jThe semantic similarity between them defines the relational similarity function f sim (r i ,r j );

[0027] S2.3, according to any two context nodes c in the context node set C i 、c j The sequence dependency relationship between them defines the context sequence correlation function f ctx (c i ,c j );

[0028] S2.4, using the function values ​​defined in steps S2.1, S2.2 and S2.3 as the coupling strength index between nodes, comprehensively form the overall coupling strength function g(v i ,v j ), the specific expression is:

[0029]

[0030] Where, v i ,v j ∈V represents any two nodes;

[0031] S2.5, according to the overall coupling strength function g(v i ,v j ) calculates the coupling strength between nodes, selects multiple nodes that exceed the preset threshold θ to form a hyperedge set H, and forms a multi-source heterogeneous hypergraph structure with semantic and time dimensions

[0032] Optionally, the S3 includes:

[0033] S3.1. Multi-source heterogeneous hypergraph structure constructed in step S2 Use graph attention network for encoding and calculate node v i Graph embedding representation of The specific formula is:

[0034]

[0035] Where:

[0036] Represents node v j Initial embedding vector, and is consistent with the matrix embedding defined in claim 2;

[0037] Represents node v i The set of neighbor nodes of

[0038] αij For node v i With neighbor node v j The attention weight between is calculated as:

[0039]

[0040] Where:

[0041] W G A trainable weight matrix for graph embedding mapping;

[0042] a is the trainable weight vector of the attention mechanism;

[0043] $|$ represents vector concatenation operation;

[0044] S3.2. Use the sequence-aware network to encode the sequence of elements in the context node set C and obtain the context sequence embedding representation The calculation formula is expressed as:

[0045]

[0046] Where:

[0047] SeqEnc(·) represents the encoding function of the sequence-aware network;

[0048] H C The context embedding matrix defined for claim 2;

[0049] S3.3. Embed the above graph into a representation Sequence embedding representation with context Input feature alignment module for fusion to obtain a unified semantic representation vector z i , the calculation formula is expressed as:

[0050]

[0051] Where:

[0052] Align(·) is the feature alignment fusion function;

[0053] z i Represents node v i The final semantic representation vector of .

[0054] Optionally, the S4 includes:

[0055] S4.1. Before or during model generation, the node semantic representation vector z obtained in step S3 is i The semantic representation vector e of the corresponding retrieved evidence node jThe semantic consistency evaluation is performed between them, and the semantic consistency score S(z i ,e j ), the specific expression is:

[0056]

[0057] Where:

[0058] z i The final semantic representation vector of the node obtained in claim 4;

[0059] e j is the semantic representation vector of the retrieved evidence node;

[0060] S4.2, based on the semantic consistency score S(z i ,e j ), calculate the confidence score C of the current generated content conf , whose expression is:

[0061]

[0062] Where:

[0063] N represents the number of nodes involved in the current generation process;

[0064] S4.3. Calculate the evidence coverage index C cov , whose expression is:

[0065]

[0066] Where:

[0067] M match Indicates the number of nodes that the current generated node successfully matches in the retrieved evidence;

[0068] M total Indicates the total number of currently generated nodes;

[0069] S4.4. Calculate the semantic deviation index C bias , whose expression is:

[0070]

[0071] Where:

[0072] The parameter definitions are the same as in step S4.2;

[0073] S4.5. Based on the above confidence score C conf , Evidence coverage indicator C cov and semantic deviation index C bias , combined with the preset threshold τ conf , τcov , τ bias , determine whether the current generated content has hallucination risk R halluc , the specific judgment conditions are:

[0074]

[0075] Where:

[0076] R halluc =1 indicates the risk of hallucinations;

[0077] R halluc =0 means there is no risk of hallucinations.

[0078] Optionally, the S5 includes:

[0079] S5.1. If the risk of hallucination is determined to exist in step S4, that is, when R halluc = 1, based on the semantic representation vector z of the current node i , triggering the reverse retrieval mechanism, the hypergraph structure constructed in step S2 Re-retrieve the evidence node set E new The specific search is based on the overall coupling strength function g(v i , v j ), select the set of nodes that meet the conditions:

[0080] E new ={v j ∣g(v i ,v j )≥γ,v j ∈V}

[0081] Where:

[0082] γ is the preset coupling strength threshold used for secondary retrieval;

[0083] S5.2. Node set E obtained by re-retrieval new The corresponding semantic representation vector Semantic representation vector z for the current node i Perform fusion reinforcement to obtain the updated semantic representation vector The specific integration methods are:

[0084]

[0085] Where:

[0086] Fuse(·) is the semantic representation fusion function;

[0087] |E new | represents the node set E new The number of midpoints;

[0088] S5.3. Update the semantic representation vector Used in the subsequent model generation process.

[0089] Optionally, the S6 includes:

[0090] S6.1. Use the causal consistency judgment module to compare the generated content with the updated semantic representation vector obtained in step S5 The causal chain consistency between them is evaluated and the causal consistency score C is calculated. causal , the specific expression is:

[0091]

[0092] Where:

[0093] σ(·) represents the sigmoid activation function;

[0094] W causal and b causal They are the trainable weight matrix and bias term in the causal consistency discrimination module respectively;

[0095] S6.2. Judgment of causal consistency score C causal Is it lower than the preset threshold τ causal If it is lower than the preset threshold, it indicates that the causal chain is inconsistent. The generated content is adjusted or partially reconstructed through the feedback control mechanism. The updated generated content is expressed as The specific adjustment method is expressed as:

[0096]

[0097] Where:

[0098] ReGen(·) represents the model based on the updated semantic representation vector The local content reconstruction function performed; o i Generate content vector representation for the original;

[0099] S6.3. Output the final content vector after causal consistency judgment and feedback control mechanism optimization Used for the final output of step S7.

[0100] Optionally, the S7 includes:

[0101] S7.1, the final content vector obtained in step S6 Decode to generate text output, define the text decoding function as Dec(·), and the final output text after decoding is represented as O final , the calculation formula is:

[0102]

[0103] Where:

[0104] The optimized final content vector outputted in step S6;

[0105] S7.2. Output the final text result after the hallucination judgment mechanism, evidence enhancement and causal consistency control optimization. final .

[0106] Optionally, the device section includes:

[0107] The input parsing module is used to receive the natural language query text Q input by the user and extract the semantic entity set E, the relation phrase set R and the context feature set C through the named entity recognition model;

[0108] Hypergraph construction module, used to construct a multi-source heterogeneous hypergraph structure containing semantic and temporal dimensions based on the node set V = E ∪ R ∪ C The coupling strength between nodes is given by the overall coupling strength function g(v i ,v j )Sure;

[0109] Semantic fusion module, used to use graph attention network to analyze the hypergraph structure Encode and get graph embedding representation And use sequence-aware network to encode the context sequence to get the context sequence embedding representation Then, the above two representations are fused into a unified semantic representation vector z through the feature alignment module i ;

[0110] Hallucination risk determination module, used to calculate the confidence score C conf , Evidence coverage C cov and semantic deviation index C bias , and according to the preset threshold τ conf ,τ cov ,τ bias Determine whether the generated content poses a risk of hallucination;

[0111] The reverse retrieval module is used to trigger the reverse retrieval mechanism when the hallucination risk judgment module determines that there is a hallucination risk, and re-retrieve the evidence node set E with the coupling strength threshold γ new , and update the semantic representation vector as

[0112] Causal consistency control module, used to calculate the causal consistency score C causal , and according to the preset threshold τ causalDetermine whether the causal chain is consistent. If not, adjust the path or partially reconstruct the generated content through the feedback mechanism and output the updated content representation.

[0113] Output module, used to represent the content Decode to generate the final optimized output text O final .

[0114] A computer-readable storage medium storing a computer program, characterized in that when the program is executed by a computer, the method according to any one of claims 1 to 8 is implemented.

[0115] The beneficial effects of the present invention are:

[0116] (1) The present invention realizes the joint modeling and deep fusion of high-order semantic relations and dynamic sequence information by adopting the technical means of multi-source heterogeneous hypergraph structure, graph attention network and sequence perception network fusion coding, effectively improving the matching accuracy and relevance of retrieval evidence and query semantics, and enhancing the authenticity and context consistency of generated content.

[0117] (2) By introducing a comprehensive hallucination risk assessment and reverse retrieval mechanism, the present invention can realize real-time dynamic hallucination risk monitoring and correction of generated content, significantly improving the credibility and stability of the model output content, and showing better adaptability in scenarios such as medical care, law, and financial consulting that require high information accuracy.

[0118] (3) In terms of causal consistency control of content generated by large models, the present invention effectively solves the problem that the existing technology lacks deep causal relationship verification when generating content, which makes hallucinations difficult to correct. It breaks through the limitation of existing RAG technology that relies solely on semantic similarity or simple attention mechanism, and realizes more accurate content generation and correction capabilities, thereby effectively improving the technical level and application value in the field of artificial intelligence text generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0119] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0120] Figure 1 This is a schematic diagram of the overall process of a method for reducing the large model hallucination problem based on RAG technology proposed by the present invention;

[0121] Figure 2 Schematic diagram of a multi-source heterogeneous hypergraph structure of a method for reducing large model hallucination problem based on RAG technology proposed in the present invention;

[0122] Figure 3 This is a schematic diagram of the hallucination risk judgment and feedback control mechanism of a method for reducing large model hallucination problems based on RAG technology proposed in the present invention. DETAILED DESCRIPTION

[0123] With respect to step S1 in claim 1, the present invention specifically adopts a pre-trained BERT-CRF named entity recognition model to extract semantic entity nodes from the input natural language query, with an entity recognition accuracy of not less than 90%; a rule template matching method combined with a method based on FastText word vector cosine similarity is used to extract relational phrase nodes, with an accuracy of not less than 85%; contextual feature nodes are obtained through a sliding window interception method, with each window length of 128 characters and a sliding step size of 64 characters. The structured representation of the nodes is trained separately using a Word2Vec model with a dimension of 128, and constitutes an initial node set. With respect to the hypergraph structure construction and embedding fusion stage described in S2 and S3 in claim 1, the present invention adopts graph attention network (GAT) and sequence perception network (unidirectional GRU) for node encoding respectively, wherein the GAT network is a two-layer structure, the node embedding dimension of each layer is 256, the number of attention heads is set to 8, and the hidden layer dimension of the GRU network is 512; the feature alignment module in the fusion stage is a fully connected neural network structure, the number of network structure layers is two, the hidden layer dimension is 256, and the activation function adopts ReLU. For the hallucination risk assessment index described in S4, the confidence score is calculated by cosine similarity and the threshold is set to 0.85. The evidence coverage is defined as the ratio of the number of successfully matched nodes to the total number of generated nodes, and the threshold is set to 0.75. The semantic deviation is calculated by 1 minus the maximum semantic similarity, and the threshold is set to 0.15. For the reverse retrieval mechanism in S5, a secondary retrieval is performed based on the overall node coupling strength function, the coupling strength threshold is set to 0.80, and the vector representation of the reinforced nodes is fused in an average pooling manner. For the causal consistency judgment module described in S6, a single-layer feedforward neural network was used, with the output being a sigmoid-activated probability value and a threshold of 0.80. The feedback control module used a beam search algorithm for path adjustment with a beam width of 5. The local reconstruction mechanism regenerated content using a context-sensitive GRU network. For step S7, the final optimized content representation vector was decoded using a single-layer Transformer decoder with a hidden layer dimension of 512 and 8 attention heads.

[0124] The present invention enhances the model's ability to capture complex semantic information in input queries and reduces the hallucination problem of generated results by constructing a multi-source heterogeneous hypergraph structure that simultaneously considers semantic and temporal dimensions. By introducing a multi-index hallucination risk assessment mechanism based on confidence scoring, evidence coverage, and semantic deviation, real-time and refined monitoring of the risks of model-generated content is achieved, and a reverse retrieval mechanism is used to timely reinforce evidence nodes, effectively improving the accuracy and reliability of the generated content. In addition, through the causal consistency discrimination feedback control module, the causal logical consistency between the generated content and external evidence is further guaranteed, so that the generated content has significant stability and practical advantages in practical scenarios such as intelligent question answering, automatic summarization, and decision assistance with high accuracy requirements.

[0125] With respect to steps S1.1 to S1.3 described in claim 2, the present invention further clarifies the specific implementation details as follows: In step S1.1, the named entity recognition model explicitly adopts the open source pre-training model DeepSeek-Base, whose specific structure is a 12-layer Transformer network, with 12 attention heads in each layer and a hidden layer size of 768 dimensions; the model is connected to the conditional random field (CRF) layer and implements sequence labeling through the Viterbi algorithm to extract the semantic entity set E = {e1, e2, ..., e m} reaches a recognition accuracy of more than 90%; the set of relational phrase nodes R = {r1, r2, ..., r n} is extracted by using rule templates combined with DeepSeek pre-trained Chinese word vectors to calculate cosine similarity for matching. The number of rule templates is specifically 30, and the accuracy of relational phrase extraction reaches more than 85%; the context feature node set C = {c1, c2, ..., c k} It is clear that a sliding window with a length of 128 characters is used for extraction, and the sliding step is 64 characters. The embedding function described in step S1.2 is specifically defined as: entity embedding function f e (·), relation embedding function f r (·), context embedding function f c (·) Use DeepSeek to pre-train Chinese word vectors and further train them on a corpus of no less than 1 million Chinese texts based on the Skip-gram algorithm of Word2Vec; the dimension of the embedding vector is specifically determined to be 128, so the entity embedding matrix H E The specific dimension is m×128, and the relation embedding matrix H R The dimension is n×128, and the context embedding matrix H C The specific dimension is k×128; the node type label set in step S1.3 is {type E ,type R,type C There is a clear one-to-one correspondence between each node type label and the corresponding node set, forming a unified node set V = E∪R∪C.

[0126] Through the above-mentioned specific and clear implementation details, the present invention effectively improves the extraction and embedding accuracy of semantic entities, relational phrases and contextual features, and significantly enhances the quality of node vector representation and the accuracy of hypergraph structure construction; by selecting the DeepSeek open source model and refined parameter settings, the stability and efficiency of the hallucination risk judgment and reverse retrieval mechanism are effectively ensured, so that the generated model response results have higher semantic authenticity and logical rigor, thereby demonstrating better reliability and application adaptability in practical applications.

[0127] With respect to steps S2.1 to S2.5 described in claim 3, the present invention further clarifies the specific implementation details as follows: the entity node co-occurrence intensity function f described in step S2.1 co-occ (e i ,e j ) explicitly defines and calculates the relationship using the normalized point mutual information (NPMI) method, where the NPMI threshold is specifically set to 0.6 to effectively determine the semantic relevance strength between entity nodes; the semantic similarity function f of the relationship node in step S2.2 sim (r i ,r j ) The cosine similarity of the Chinese word vectors pre-trained by DeepSeek is used for specific calculations, and the similarity threshold is explicitly set to 0.75 to effectively determine the semantic similarity between relationship nodes; in step S2.3, the context node sequence relevance function f ctx (c i ,c j ) explicitly uses the Jaccard similarity coefficient method of the sequence sliding window to calculate the sequence dependency correlation, where the window length is set to 128 characters and the Jaccard similarity coefficient threshold is specifically set to 0.7; in step S2.4, the overall coupling strength function g(v i ,v j ) is calculated using a piecewise function, where the coupling strength of each type of node is specifically selected from the functions and thresholds clearly defined in the above steps, and is stored and managed in a Python dictionary data structure during actual calculation; the hypergraph hyperedge set H described in step S2.5 is constructed by comparing the above overall coupling strength function g(v i ,v j ) is compared with the preset coupling strength threshold of 0.75 to form a hyperedge set H, forming a multi-source heterogeneous hypergraph structure.

[0128] The present invention effectively improves the accuracy and rationality of node relationship calculation by specifically and clearly using normalized point mutual information, cosine similarity and Jaccard coefficient to define the coupling strength function between different types of nodes respectively; integrates and manages the overall coupling strength through piecewise functions, and strictly sets thresholds for hypergraph construction, thereby enhancing the construction accuracy and robustness of multi-source heterogeneous hypergraph structures, thereby significantly improving the semantic consistency and credibility of the generated content, and is suitable for the fields of intelligent question answering and information retrieval with high accuracy requirements.

[0129] With respect to steps S3.1 to S3.3 described in claim 4, the present invention further clarifies the specific implementation details as follows: the graph attention network (GAT) described in step S3.1 is specifically defined as a two-layer structure, the node embedding dimension of the first layer is set to 256, the node embedding dimension of the second layer is also 256, the number of attention heads in each layer of the network is specifically set to 8, the negative slope coefficient of the LeakyReLU function is specifically 0.2, and the node embedding mapping matrix W G The dimension of the attention mechanism weight vector a is 256×128, and the dimension of the attention mechanism weight vector a is clearly 512×1. In step S3.2, the sequence perception network SeqEnc(·) specifically adopts a unidirectional gated recurrent unit (GRU) structure. The hidden layer dimension of the GRU is clearly set to 512, the number of layers is specifically 2, and the input context embedding matrix H is used. C The dimension is k×128, and the output context sequence embedding representation vector The dimension is specifically determined to be k×512; the feature alignment fusion function Align(·) described in step S3.3 is clearly implemented using a two-layer feedforward neural network structure, the number of neurons in the first layer is clearly 256, the number of output neurons in the second layer is clearly 128, the activation function is specifically selected as ReLU, and the unified semantic representation vector z i The dimension is specifically determined to be 128 dimensions.

[0130] The present invention effectively improves the feature capture and encoding capabilities of complex semantic relationships between nodes and contextual sequence information by accurately defining the structure and parameter settings of the graph attention network and sequence perception network; through a specific and clear feature alignment fusion function structure, it achieves efficient fusion of graph structure features and sequence features, improves the quality and stability of the final semantic representation, and effectively enhances the accuracy and credibility of the content generated by the model, which has significant advantages in intelligent question answering, information retrieval, and application fields that require high-precision semantic representation.

[0131] With respect to steps S4.1 to S4.5 described in claim 5, the present invention further clarifies the specific implementation details as follows: in step S4.1, the semantic consistency score function S(z i , e j) Specifically, cosine similarity is used for calculation, where the final semantic representation vector z of the node is i and the retrieved evidence node representation vector e j The dimension is clearly 128; in step S4.2, the confidence score C is set conf The maximum semantic consistency score is used for calculation, and the number of nodes N is clearly limited to between 5 and 50; the evidence coverage index C in step S4.3 is cov The calculation of the current generation node and the retrieval evidence node is clearly defined as a match is successful when the semantic consistency score exceeds 0.75, and the number of matching nodes is M. match With the total number of nodes M total Explicitly set between 5 and 50; the semantic deviation indicator C in step S4.4 bias The minimum inconsistency average value is used for calculation; the threshold for hallucination risk determination preset in step S4.5 is specifically: confidence score threshold τ conf Set to 0.85, the evidence coverage threshold τ cov Set to 0.75, the semantic deviation threshold τ bias Set to 0.15, if any condition is met, it is determined that there is a hallucination risk R halluc =1.

[0132] The present invention enhances the accuracy and pertinence of model-generated content risk assessment by precisely defining the specific indicators and thresholds for hallucination risk assessment; by strictly defining specific parameters such as the number of nodes and matching thresholds, the stability and consistency of hallucination risk judgment are effectively improved, enabling the present invention to more effectively reduce hallucination problems in text generation tasks and significantly improve the credibility of model response content, making it particularly suitable for applications in professional fields that have high requirements for the accuracy of generated content.

[0133] With respect to steps S5.1 to S5.3 described in claim 6, the present invention further specifies the specific implementation details as follows: the preset coupling strength threshold γ for secondary retrieval described in step S5.1 is specifically set to 0.80, and by comparing the overall coupling strength function g(v i ,v j ) The calculated value of the node coupling strength and the threshold value are used to strictly determine the newly retrieved node set E new The semantic representation fusion function Fuse(·) described in step S5.2 specifically adopts a weighted average method with attention weights for fusion, where the attention weights are calculated by combining the node vector to be fused with the semantic representation vector z of the current node. i The cosine similarity is calculated to obtain the updated semantic representation vector after fusion. The dimension is clearly 128; the node set E new The number of nodes in |E new|Specifically limited to no less than 3 and no more than 20; the semantic representation vector updated in step S5.3 It is directly and explicitly used in the subsequent Transformer decoder generation process to ensure that the vector dimension strictly matches the decoder input dimension, specifically 128 dimensions.

[0134] The present invention significantly improves the accuracy of secondary retrieval nodes and the effectiveness of semantic reinforcement by precisely defining the threshold of node coupling strength and the attention-weighted fusion method of semantic representation fusion in the reverse retrieval process; by strictly limiting the node number range of the new node set and clarifying the vector dimension parameters, the consistency and stability of the model update process are ensured, thereby effectively reducing the risk of hallucinations in the model generation process and greatly improving the objectivity and authenticity of the generated content. It is particularly suitable for the fields of high-precision information generation and rigorous content generation.

[0135] With respect to steps S7.1 to S7.2 described in claim 8, the present invention further specifies the specific implementation details as follows: the text decoding function Dec(·) described in step S7.1 is explicitly implemented using a Transformer decoder, the number of decoder layers is explicitly set to 2, the hidden layer dimension is specifically 512 dimensions, the number of multi-head attention heads per layer is explicitly set to 8, the intermediate layer dimension in the feedforward neural network layer is explicitly set to 2048 dimensions, and the activation function specifically uses a ReLU function; the final content vector input to the decoder The dimension is clearly 128-dimensional, and is upgraded to 512-dimensional through linear mapping to match the decoder; the decoding process uses the Beam Search algorithm for text generation, and the search beam width is clearly set to 5; the final text result output is O final The length limit range is specifically between 20 and 300 Chinese characters; the final text result output in step S7.2 is O final It can be directly used in actual intelligent question-answering systems or information retrieval systems to ensure that the output content strictly meets the input query requirements and has high accuracy and authenticity.

[0136] The present invention effectively ensures the high quality and stability of the generated content by specifically defining the network structure parameters of the Transformer decoder and the algorithm details of the decoding generation; by precisely limiting the length range and dimensional matching relationship of the final output text, the applicability and reliability of the output content in actual application scenarios are improved, thereby effectively improving the controllability and practicality of the content generated by the model, and is particularly suitable for practical application fields that have strict requirements on the quality and accuracy of the generated content.

[0137] For each module of the device described in claim 9, the present invention further clarifies the specific implementation details as follows: the input parsing module uses the DeepSeek-Base pre-training model combined with CRF to extract entities, the number of rule templates is specifically more than 30, the sliding window length is 128 characters, and the step length is 64 characters; the overall coupling strength function g(v i ,v j ) Specifically, the normalized point mutual information (NPMI), DeepSeek Chinese word vector cosine similarity and sequence Jaccard coefficient are used for calculation, and the node coupling strength threshold is set to 0.75; the semantic fusion module adopts a two-layer graph attention network (GAT) structure, with a node embedding dimension of 256, 8 attention heads, a sequence perception network that is clearly a unidirectional GRU, a hidden layer dimension of 512, and a feature alignment fusion that is a two-layer feedforward network structure with an output dimension of 128; the thresholds of the hallucination risk judgment module are clearly set as follows: the confidence score threshold is 0.85, the evidence threshold is 0. The coverage threshold is 0.75 and the semantic deviation threshold is 0.15; the coupling strength threshold of the reverse retrieval module is set to 0.80, and the node fusion method is clearly attention-weighted averaging; the causal consistency control module uses a single-layer feedforward neural network structure for probability judgment, the threshold is set to 0.80, and the path adjustment uses the BeamSearch algorithm with a beam width of 5; the output module specifically uses a two-layer Transformer decoder structure, with a hidden layer dimension of 512, 8 attention heads, a decoding beam width of 5, and an output text length of 20 to 300 Chinese characters.

[0138] The device of the present invention effectively improves the accuracy, stability and coordination of the overall model operation by clearly defining the specific implementation methods and parameters of each module, significantly reduces the occurrence of hallucinations in the generated content, ensures the semantic consistency and logical rigor of the output content, and has good reliability and practical application advantages in scenarios such as intelligent question answering, information retrieval and decision assistance.

[0139] Example 1:

[0140] In this embodiment, the method of the present invention is applied to a customer question-answering system of a large technology company to effectively reduce the probability of hallucinations when the large language model answers questions.

[0141] The company has multiple complex products and a vast knowledge base, and customers frequently use online Q&A platforms to inquire about product features, user guides, and troubleshooting. The original question-and-answer system used the DeepSeek-R1 large language model as its core engine. DeepSeek-R1 has excellent natural language understanding and reasoning capabilities, but when it lacks specific domain knowledge, it is prone to "hallucinations"—that is, giving answers that are inconsistent with the facts or fabricated out of thin air. This hallucination phenomenon causes some answers to be inconsistent with the actual situation of the company's products, which may mislead customers, reduce user satisfaction, and bring potential technical support risks. Therefore, the company urgently needs a solution to reduce the model's hallucination rate and improve the accuracy of answers.

[0142] To address the aforementioned issues, this embodiment employs a hallucination suppression method based on RAG (Retrieval-Augmented Generation) technology, proposed in this invention. Its core concept is to retrieve relevant information for the user's question before the model generates an answer. The retrieved real-world information is provided to the DeepSeek-R1 model as auxiliary information, guiding it to provide answers based on reliable information and reducing unfounded inferences. The specific deployment process is as follows: First, the enterprise connects its internal knowledge base to the question-answering system as a retrieval source. This knowledge base contains a large amount of documents such as product specifications, user manuals, FAQs, and technical bulletins, and is preprocessed to create an efficient index structure. For example, the system uses vectorized retrieval technology to convert document content into semantic vectors, which are stored in a vector database to quickly retrieve relevant content based on the user's question. Then, a retrieval module and a generation module are integrated into the question-answering system. When a customer submits a question, the retrieval module searches the knowledge base for document fragments related to the question (such as key paragraphs or answer fragments) and extracts the most relevant pieces of information. Next, the system packages the retrieved content together with the original question to form an extended prompt and sends it to the DeepSeek-R1 model. After receiving the question and its related background information, the model will prioritize reasoning and generating answers based on the real information provided, and strictly follow the "answer based on given information" instruction internally to avoid subjective speculation that is divorced from the search content. In addition, when insufficient relevant information is retrieved, the model is designed to politely explain to the user that no relevant answers can be found, rather than fabricating information. Through the above mechanism, the method of the present invention reduces the probability of generating erroneous information from the source.

[0143] In specific applications, the question-answering system works as follows: A customer first asks a question, such as "Does product X support function Y?" If a traditional model directly generates an answer, DeepSeek-R1, due to its limited knowledge of the company's latest product details, may provide inaccurate guesses, such as incorrectly answering "supported" with some speculative explanations—a typical hallucination. However, using the method of the present invention, the system automatically searches the company's knowledge base for information related to product X and function Y. Suppose the search results reveal that internal company technical documents clearly state that "product X does not currently support function Y." DeepSeek-R1 will then generate an accurate answer based on the retrieved real information, such as "According to the company's product specifications, product X currently does not support function Y." If alternatives are available, the model may also explain the supported functions of the relevant product or provide an upgrade plan. This answer directly cites authoritative information, making it consistent with the facts and reliable and verifiable. Thus, by incorporating a search step before answer generation, the DeepSeek-R1 model no longer relies solely on its own training data to generate answers. Instead, it incorporates the latest and most accurate information from the company's knowledge base into its answers, effectively avoiding the generation of unfounded content.

[0144] After implementing the method of the present invention, the performance indicators of the enterprise question-answering system were significantly improved. The following indicators were mainly examined: hallucination rate (the proportion of model answers containing false or untrue content), response accuracy (the proportion of model answers that matched the real answers), and customer satisfaction (the satisfaction rate based on customer feedback survey statistics). Table 1 shows a comparison of the above indicators of the question-answering system before applying the present invention (using only the DeepSeek-R1 model) and after applying the present invention (integrating the RAG method).

[0145] Table 1 Comparison of performance indicators before and after the enterprise question answering system deploys the method of the present invention

[0146] index Before deployment: DeepSeek-R1 only Post-deployment: Integrating the RAG approach Hallucination rate (%) 13.5% 2.4% Response accuracy (%) 81% 95% Customer satisfaction (%) 76% 93%

[0147] It can be seen from the above data that after applying the method of the present invention, the hallucination rate of the question-answering system has been greatly reduced from the original approximately 13.5% to 2.4%, significantly reducing the occurrence of erroneous and false answers. At the same time, the response accuracy rate has increased from 81% to 95%, indicating that the degree of conformity between the model answers and the facts has been greatly improved; customer satisfaction has increased from 76% to 93%, indicating that users' recognition of the quality of the answers has been significantly improved. These improvements fully demonstrate that the present invention effectively alleviates the hallucination problem of large models in actual scenarios and effectively improves the reliability and practicality of the question-answering system. By introducing a retrieval-enhanced generation mechanism, the present invention combines the powerful generation capabilities of large language models with the precise information of the enterprise knowledge base. While maintaining the original language understanding and reasoning advantages of DeepSeek-R1, it constrains it to answer based on real data, successfully balancing the intelligence and information accuracy of generative AI, and providing an effective technical solution for reducing large model hallucinations.

[0148] Example 2

[0149] In order to verify the practical application effect of the present invention, the method of the present invention is applied to the intelligent enrollment customer service system of a private college in Anhui Province. The college is located in Hefei City, Anhui Province. It is a comprehensive private undergraduate college that recruits students from all over the country every year. During the enrollment period, it needs to handle a large number of inquiries from candidates and parents. Previously, the school had adopted a traditional large-model intelligent customer service system to answer various questions encountered in the enrollment process, including professional settings, enrollment policies, scholarship policies, dormitory conditions, employment prospects, etc. The intelligent customer service system often encounters "hallucination" problems when answering specific questions, that is, there is false or unverified information in the generated content, which leads to differences between the answers and the actual situation of the school. Not only can it not effectively solve the consultant's problems, it is also easy to cause unnecessary misunderstandings. In serious cases, it even causes some candidates and parents to have a negative impression of the school. Therefore, the school urgently needs a method to effectively solve the problem of hallucinations in the generated content of the intelligent customer service system.

[0150] In order to effectively solve the above problems, the school deployed the method proposed in this invention based on RAG (retrieval enhanced generation) technology to reduce the large model hallucination problem in February 2025, and adopted the latest open source large language model DeepSeek-R1 as the basic large model.

[0151] First, the university established a comprehensive admissions knowledge base, which details authoritative information such as the school's latest admissions brochures, program introductions, historical enrollment data, admissions consultation FAQs, campus facility details, scholarship policies, and employment statistics. After repeated verification by professionals, this information was efficiently indexed using semantic vectorization technology to quickly retrieve relevant information during real-time consultations.

[0152] During the specific technical implementation, when a candidate or parent enters an admissions-related question through the online consultation platform, the system first automatically retrieves the most relevant information from the knowledge base. For specific questions, such as "What are the new majors being added to the school in 2025?" "What are the historical admission scores for a certain major?" "What are the specific application requirements for a scholarship?", the system quickly extracts the corresponding real-world information fragments as auxiliary information and provides them to the DeepSeek-R1 model. Subsequently, after receiving the user's original question and the retrieved real-world information, the DeepSeek-R1 model is explicitly constrained to prioritize the provided factual information when generating an answer, strictly avoiding arbitrary assumptions or generating unfounded content. If the model cannot find a valid answer from the retrieved information, the system directly responds to the user that the relevant information is not currently included in the current knowledge base, thereby avoiding the generation of false information. This explicit retrieval-enhanced generation method effectively prevents the tendency of traditional large models to make arbitrary assumptions in the absence of information, fundamentally reducing the probability of hallucinations.

[0153] Take a specific application scenario as an example. A parent of a student asks, "What new undergraduate majors will your school offer in 2025?" Traditional large models may incorrectly generate unverified major information due to a lack of up-to-date information, leading to misleading responses. However, after the deployment of the technical method of the present invention, the system instantly searches the admissions knowledge base for the latest admissions brochure information and finds the clearly recorded "New undergraduate majors in 2025: Artificial Intelligence, Big Data Technology and Applications, Intelligent Manufacturing Engineering." The DeepSeek-R1 model then responds strictly based on this retrieved information: "According to the school's latest admissions brochure, our school's new undergraduate majors in 2025 are: Artificial Intelligence, Big Data Technology and Applications, and Intelligent Manufacturing Engineering." This type of response based on real information ensures the accuracy and reliability of the information and effectively avoids misunderstandings caused by hallucinations.

[0154] The implementation effect of the present invention has also been significantly demonstrated in actual operation. The school's intelligent customer service system was officially put into operation during the peak enrollment period from February to May 2025. After four months of continuous monitoring and data comparison, the key performance indicators before and after the application of the method of the present invention were recorded. The specific performance data are shown in Table 1:

[0155] Table 1 Performance comparison of the intelligent enrollment customer service system of a private university in Anhui Province before and after application

[0156] Indicator name Before deploying the present invention After deploying the present invention Percentage of hallucination content (%) 17.2% 2.1% Answer accuracy (%) 78.4% 96.3% Customer satisfaction (out of 10 points) 6.3 points 9.5 points Number of customer complaints (times / month) 23 1 Average Q&A response time (seconds) 15 seconds 2 seconds Number of effective consultations processed per month (times) 4100 7800

[0157] It can be seen from the data in the above table that after the implementation of the present invention, the proportion of illusion content in the university's intelligent enrollment customer service system has dropped significantly from the original 17.2% to 2.1%, greatly reducing the probability of generating inaccurate or false information. At the same time, the accuracy of the answers has increased from the original 78.4% to 96.3%, significantly improving the credibility and accuracy of the answers. The customer satisfaction score has increased significantly from 6.3 points before deployment to 9.5 points after deployment, reflecting the high recognition of the quality of the system's answers by candidates and parents. In addition, the number of customer complaints has dropped from an average of 23 times per month in the past to 1 time, proving that the improvement in system quality has directly reduced negative feedback from customers. At the same time, the system response speed has dropped from an average of 15 seconds to 2 seconds, and the number of valid consultations processed per month has also increased significantly, from 4,100 times to 7,800 times, greatly improving the efficiency of university enrollment services and customer experience.

[0158] The above-mentioned specific implementation and data comparison results clearly demonstrate that the proposed method for reducing the hallucination problem of large models based on RAG technology successfully addresses the hallucination problem of content generated by large language models in the university's intelligent admissions customer service system. By combining explicit knowledge base retrieval assistance with the DeepSeek-R1 model, the answers generated by the model achieve the goals of clear factual basis and significantly improved accuracy. This not only effectively enhances the user experience of candidates and parents, but also significantly reduces complaints and misunderstandings caused by hallucinations, strongly supporting the improvement of the quality of university admissions services and the overall image of the school, demonstrating the effectiveness and practical value of the technical solution of the present invention.

Claims

1. A method for reducing the hallucination problem of large models based on RAG technology, characterized in that: The steps include: S1. Under the RAG architecture, receive natural language queries input by users, extract semantic entities, relation phrases and context features, and construct a structured set of entity nodes, relation nodes and context nodes; S2. Based on entity co-occurrence, semantic relevance, and context sequence dependency, a high-order semantic coupling relationship is established between nodes to generate a multi-source heterogeneous hypergraph structure containing hyperedges in semantic and temporal dimensions. S3, respectively uses the graph attention network to encode the hypergraph structure, uses the sequence perception network to model the context, and fuses them into a unified semantic representation vector through the feature alignment module; S4. Before or during model generation, evaluate the consistency between the output semantic state and the retrieved evidence, and determine whether there is a risk of hallucination based on the confidence score, evidence coverage, and semantic bias indicators; S5. When the hallucination risk is higher than the set threshold, the reverse retrieval mechanism is triggered to re-retrieve relevant evidence nodes in the hypergraph based on the current semantic state and fuse the reinforced semantic representation; S6. The causal consistency judgment module determines the consistency of the causal chain between the generated content and the supporting evidence. If they are inconsistent, the generation path or local content is adjusted through the feedback mechanism. S7. Output the final model response result after hallucination judgment, evidence enhancement and causal consistency control optimization.

2. The method according to claim 1, characterized in that Said S1 specifically includes: S1.

1. Receive a natural language query text Q input by the user, and extract a semantic entity set E = {e1, e2, ..., e m }、Relational phrase set R={r1,r2,…,r n } and context feature set C = {c1, c2, ..., c k }; S1.

2. Perform vector embedding on the sets E, R, and C respectively, and define the entity embedding function as f e (·), the relation embedding function is f r (·), the context embedding function is f c (·), calculate the entity embedding matrix H E , relation embedding matrix H R and the context embedding matrix H C , specifically expressed as: Among them, m, n, and k represent the number of elements in the sets E, R, and C respectively; d1, d2, and d3 are the dimensions of semantic entity, relation phrase, and context feature vector embeddings, respectively; S1.

3. The embedded entities, relationships and context nodes are unified into a structured node set V = E∪R∪C, and for each node v in the node set i ∈V assigns the corresponding type label t i ∈{type E ,type R ,type C }.

3. The method according to claim 1, characterized in that The S2 specifically includes: S2.1, based on the node set V=E∪R∪C obtained in step S1, according to any two entity nodes e in the entity node set E, i 、e j The co-occurrence frequency between them defines the co-occurrence intensity function f co-occ (e i ,e j ); S2.2, according to any two relationship nodes r in the relationship node set R i 、r j The semantic similarity between them defines the relational similarity function f sim (r i ,r j ); S2.3, according to any two context nodes c in the context node set C i 、c j The sequence dependency relationship between them defines the context sequence correlation function f ctx (c i ,c j ); S2.4, using the function values ​​defined in steps S2.1, S2.2 and S2.3 as the coupling strength index between nodes, comprehensively form the overall coupling strength function g(v i ,v j ), the specific expression is: Where, v i ,v j ∈V represents any two nodes; S2.5, according to the overall coupling strength function g(v i ,v j ) calculates the coupling strength between nodes, selects multiple nodes that exceed the preset threshold θ to form a hyperedge set H, and forms a multi-source heterogeneous hypergraph structure with semantic and time dimensions 4. The method according to claim 1, wherein The S3 specifically includes: S3.

1. Multi-source heterogeneous hypergraph structure constructed in step S2 Use graph attention network for encoding and calculate node v i Graph embedding representation of The specific formula is: Where: Represents node v j Initial embedding vector, and is consistent with the matrix embedding defined in claim 2; Represents node v i The set of neighbor nodes of α ij For node v i With neighbor node v j The attention weight between is calculated as: Where: W G A trainable weight matrix for graph embedding mapping; a is the trainable weight vector of the attention mechanism; $|$ represents vector concatenation operation; S3.

2. Use the sequence-aware network to encode the sequence of elements in the context node set C and obtain the context sequence embedding representation The calculation formula is expressed as: Where: SeqEnc(·) represents the encoding function of the sequence-aware network; H C The context embedding matrix defined for claim 2; S3.

3. Embed the above graph into a representation Sequence embedding representation with context Input feature alignment module for fusion to obtain a unified semantic representation vector z i , the calculation formula is expressed as: Where: Align(·) is the feature alignment fusion function; z i Represents node v i The final semantic representation vector of .

5. The method according to claim 1, characterized in that The S4 specifically includes: S4.

1. Before or during model generation, the node semantic representation vector z obtained in step S3 is i The semantic representation vector e of the corresponding retrieved evidence node j The semantic consistency evaluation is performed between them, and the semantic consistency score S(z i ,e j ), the specific expression is: Where: z i The final semantic representation vector of the node obtained in claim 4; e j is the semantic representation vector of the retrieved evidence node; S4.2, based on the semantic consistency score S(z i ,e j ), calculate the confidence score C of the current generated content conf , whose expression is: Where: N represents the number of nodes involved in the current generation process; S4.

3. Calculate the evidence coverage index C cov , whose expression is: Where: M match Indicates the number of nodes that the current generated node successfully matches in the retrieved evidence; M total Indicates the total number of currently generated nodes; S4.

4. Calculate the semantic deviation index C bias , whose expression is: Where: The parameter definitions are the same as in step S4.2; S4.

5. Based on the above confidence score C conf , Evidence coverage indicator C cov and semantic deviation index C bias , combined with the preset threshold τ conf , τ cov , τ bias , determine whether the current generated content has hallucination risk R halluc , the specific judgment conditions are: R halluc =1 indicates the risk of hallucinations; R halluc =0 means there is no risk of hallucinations.

6. The method according to claim 1, characterized in that The S5 specifically includes: S5.

1. If the risk of hallucination is determined to exist in step S4, that is, when R halluc = 1, based on the semantic representation vector z of the current node i , triggering the reverse retrieval mechanism, the hypergraph structure constructed in step S2 Re-retrieve the evidence node set E new The specific search is based on the overall coupling strength function g(v i , v j ), select the set of nodes that meet the conditions: E new ={v j ∣g(v i ,v j )≥γ,v j ∈V} Where: γ is the preset coupling strength threshold used for secondary retrieval; S5.

2. Node set E obtained by re-retrieval new The corresponding semantic representation vector Semantic representation vector z for the current node i Perform fusion reinforcement to obtain the updated semantic representation vector The specific integration methods are: Where: Fuse(·) is the semantic representation fusion function; |E new | represents the node set E new The number of midpoints; S5.

3. Update the semantic representation vector Used in the subsequent model generation process.

7. The method according to claim 1, characterized in that The S6 specifically includes: S6.

1. Use the causal consistency judgment module to compare the generated content with the updated semantic representation vector obtained in step S5 The causal chain consistency between them is evaluated and the causal consistency score C is calculated. causal , the specific expression is: Where: σ(·) represents the sigmoid activation function; W causal and b causal They are the trainable weight matrix and bias term in the causal consistency discrimination module respectively; S6.

2. Judgment of causal consistency score C causal Is it lower than the preset threshold τ causal If it is lower than the preset threshold, it indicates that the causal chain is inconsistent. The generated content is adjusted or partially reconstructed through the feedback control mechanism. The updated generated content is expressed as The specific adjustment method is expressed as: Where: ReGen(·) represents the model based on the updated semantic representation vector The local content reconstruction function performed; o i Generate content vector representation for the original; S6.

3. Output the final content vector after causal consistency judgment and feedback control mechanism optimization Used for the final output of step S7.

8. The method according to claim 1, characterized in that The S7 specifically includes: S7.1, the final content vector obtained in step S6 Decode to generate text output, define the text decoding function as Dec(·), and the final output text after decoding is represented as O final , the calculation formula is: Where: The optimized final content vector outputted in step S6; S7.

2. Output the final text result after the hallucination judgment mechanism, evidence enhancement and causal consistency control optimization. final .

9. A device for reducing the large model hallucination problem based on RAG technology, characterized in that: include: The input parsing module is used to receive the natural language query text Q input by the user and extract the semantic entity set E, the relation phrase set R and the context feature set C through the named entity recognition model; Hypergraph construction module, used to construct a multi-source heterogeneous hypergraph structure containing semantic and temporal dimensions based on the node set V = E ∪ R ∪ C The coupling strength between nodes is given by the overall coupling strength function g(v i ,v j )Sure; Semantic fusion module, used to use graph attention network to analyze the hypergraph structure Encode and get graph embedding representation And use sequence-aware network to encode the context sequence to get the context sequence embedding representation Then, the above two representations are fused into a unified semantic representation vector z through the feature alignment module i ; Hallucination risk determination module, used to calculate the confidence score C conf , Evidence coverage C cov and semantic deviation index C bias , and according to the preset threshold τ conf ,τ cov ,τ bias Determine whether the generated content poses a risk of hallucination; The reverse retrieval module is used to trigger the reverse retrieval mechanism when the hallucination risk judgment module determines that there is a hallucination risk, and re-retrieve the evidence node set E with the coupling strength threshold γ new , and update the semantic representation vector as Causal consistency control module, used to calculate the causal consistency score C causal , and according to the preset threshold τ causal Determine whether the causal chain is consistent. If not, adjust the path or partially reconstruct the generated content through the feedback mechanism and output the updated content representation. Output module, used to represent the content Decode to generate the final optimized output text O final .

10. A computer-readable storage medium storing a computer program, characterized in that: When the program is executed by a computer, the method according to any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Intelligent agent illusion correction method and device

    CN120892546A

  • Dynamic retrieval enhancement generation method and system based on attention attribution

    CN121029954A

  • Knowledge tracking and evidence labeling combined RAG question and answer system

    CN121092675A

  • A RAG question-answering system that combines knowledge tracking and evidence annotation

    CN121092675B

  • Language model illusion suppression dynamic decoding method based on multi-dimensional contrast signal

    CN121168670A