Document generation large model illusion content endogenous verification self-marking method and system
By constructing a domain knowledge graph and a real-time self-verification mechanism, the problem of detecting and correcting hallucinatory content in document generation was solved, realizing real-time verification and accuracy in the document generation process, and ensuring the reliability and risk level identification of the generated content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING YIZHUANG INTELLIGENT CITY RES INST GRP CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-04-28
AI Technical Summary
In existing technologies, large document generation models cannot achieve real-time, intrinsic error detection and correction after generating content, resulting in the generation of content having illusion problems and failing to meet the reliability and accuracy requirements of professional fields.
By constructing a domain knowledge graph, data sources in the target professional field are obtained and entity recognition and relation extraction are performed. A comparative training corpus containing factual samples and hallucination samples is established. Domain factual features and hallucination difference features are learned. The generation task is decomposed into multi-level semantic units, and self-verification is performed in real time during the generation process to generate professional documents with risk level labels and verification conclusions.
It enables real-time verification during the document generation process, ensuring the accuracy and reliability of the generated content. It can perform fine-grained verification and provide risk level identification, reducing the cost of subsequent corrections.
Smart Images

Figure CN121936458A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and system for endogenous verification and self-labeling of illusion content in large-scale document generation models. Background Technology
[0002] This invention relates to the field of artificial intelligence technology, and in particular to a method for verifying and tagging illusory content in a large model for document generation.
[0003] In the field of artificial intelligence, automatically generating professional documents using large language models has become an important means of improving content production efficiency. Current conventional practices typically rely on prior knowledge gained by the model during training on general corpora for content generation. To address the "illusion" problem in generated content—where the model generates content that appears reasonable but does not conform to facts or domain expertise—a common verification strategy is to introduce an external, independent verification module or tool after the generation process is complete. These external verification methods typically treat the complete document or paragraph generated by the model as a whole, performing post-verification by calling external knowledge base retrieval interfaces, fact-checking APIs, or rule-based validators. This post-verification mechanism aims to identify and flag errors or uncertainties in the document.
[0004] Because the verification process occurs after content generation is complete, the verification module and the generation model are decoupled, making real-time, intrinsic error detection and correction impossible. This separated architecture results in a lack of immediate feedback based on domain facts during the generation process. The model continuously generates a series of coherent semantic units with underlying factual errors, which are only discovered during final review, increasing the cost and complexity of subsequent corrections. External verification is typically performed on longer text segments, making it difficult to precisely pinpoint the specific semantic unit level at which errors occur. Its feedback signals are also relatively coarse, hindering the model from making fine-grained adaptive adjustments during generation. These shortcomings limit the reliability and accuracy of generated documents within professional domains, making it difficult to meet the requirements of application scenarios with stringent factual consistency requirements. Summary of the Invention
[0005] This invention provides a method and system for endogenous verification and self-labeling of large-scale illusion content in document generation, which can solve the problems in the prior art.
[0006] A first aspect of the present invention provides a method for endogenous verification and self-labeling of large-scale illusion content in document generation, comprising:
[0007] Data sources in the target professional field are acquired and a domain knowledge graph is constructed through entity recognition and relation extraction. A comparative training corpus containing factual samples and hallucination samples is constructed based on the domain knowledge graph. The target professional field includes generating medical diagnosis descriptions.
[0008] The large model learns domain factual features and illusion difference features through the contrastive training corpus, establishes a mapping relationship between content credibility and confidence score, and embeds the structured information of the domain knowledge graph into the model parameters;
[0009] Receive document generation task instructions and break them down into multiple logically related subtasks, and divide each subtask into multi-level semantic units according to semantic integrity;
[0010] After generating the multi-level semantic units, an endogenous self-verification is triggered. The endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph to verify the consistency of entity knowledge in the semantic units. Based on the verification result of the entity knowledge consistency and the mapping relationship, a confidence score and verification conclusion are obtained.
[0011] Based on the confidence score, a classification judgment is performed, the generated content is divided into multiple risk levels, standardized marked content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic unit to form a marked professional document.
[0012] Data sources in the target professional field are acquired, and a domain knowledge graph is constructed through entity recognition and relation extraction. Based on the domain knowledge graph, a comparative training corpus containing factual samples and illusion samples is constructed, including:
[0013] By using a cross-modal semantic alignment mechanism, multimodal feature extraction and feature encoding are performed on the text descriptions and structured knowledge carriers in the data source of the target professional field to obtain entity representations of different modalities. By constructing a cross-modal semantic space, entity representations of different modalities are mapped to a unified vector space.
[0014] Based on the semantic similarity in the unified vector space, entity disambiguation and relation completion are performed to construct the domain knowledge graph that integrates multimodal knowledge;
[0015] By using a counterfactual reasoning generation strategy, the causal relationship paths in the domain knowledge graph are logically reversed to generate counterfactual illusion samples that violate domain common sense, the temporal constraint relationship is scrambled to generate anti-temporal logical illusion samples, and the hierarchical belonging relationship is hierarchically cross-grafted to generate anti-classification system illusion samples.
[0016] The counterfactual illusion samples, the counter-temporal logic illusion samples, and the counter-classification system illusion samples are used as deep logic illusion samples. The domain knowledge graph is used to extract entity-relationship-attribute triples to obtain initial knowledge triples, which are then used as fact samples. The deep logic illusion samples and the fact samples together constitute the contrastive training corpus.
[0017] The large model learns domain factual features and hallucination difference features through the aforementioned contrastive training corpus, and establishes a mapping relationship between content credibility and confidence score, including:
[0018] The domain knowledge graph is encoded using graph structure to generate domain knowledge anchor point representations;
[0019] The system constructs positive and negative sample pairs by combining factual samples and deep logical illusion samples from the contrastive training corpus. The large model encodes the positive and negative sample pairs to obtain sample representations. The distance between the sample representations and the domain knowledge anchor representations is calculated using a contrastive loss function. The system maximizes the similarity between the factual sample representations and the domain knowledge anchor representations and minimizes the similarity between the deep logical illusion sample representations and the domain knowledge anchor representations. The system learns the domain factual features and the illusionary difference features.
[0020] The similarity between the sample representation and the domain fact features is calculated as the factual conformity, and the similarity between the sample representation and the hallucination difference features is calculated as the hallucination deviation. The factual conformity and the hallucination deviation are used as the content credibility feature vector.
[0021] By fitting the nonlinear relationship between the content credibility feature vector distribution and the labeled confidence score of the samples in the comparative training corpus, a mapping rule is established to establish a continuous mapping relationship from the content credibility feature vector to the confidence score.
[0022] The system receives document generation task instructions and breaks them down into multiple logically related subtasks. Each subtask is then divided into multi-level semantic units based on semantic integrity, including:
[0023] The document generation task instructions are semantically parsed to extract task objectives. Dependency analysis is used to identify the pre-dependencies in the task objectives. Based on the pre-dependencies, the necessary preceding sub-tasks are determined.
[0024] The document generation task instruction is broken down into multiple subtasks and a dependency identifier is assigned to each subtask. The dependency identifier records the set of preceding subtasks of the subtask. A directed dependency graph is constructed between the multiple subtasks through the dependency identifier to ensure the logical association between the subtasks.
[0025] Semantic transition points are obtained by calculating the semantic similarity and topic consistency between adjacent semantic segments. Semantic unit boundaries are defined at the semantic transition points. Semantic units are judged according to the semantic integrity standard to determine whether they contain a complete subject-verb-object structure and independent knowledge expression. Semantic units that do not meet the semantic integrity standard are adjusted until the semantic unit can independently express complete semantics.
[0026] Based on the abstraction level of the semantic units, the semantic units are divided into topic-level semantic units, paragraph-level semantic units, and sentence-level semantic units to form a multi-level semantic unit system.
[0027] At the semantic transition point, semantic unit boundaries are defined. Based on the semantic integrity standard, it is determined whether the semantic unit contains a complete subject-verb-object structure and independent knowledge representation. For semantic units that do not meet the semantic integrity standard, the semantic unit boundaries are adjusted until the semantic unit can independently express complete semantics, including:
[0028] Initial semantic units are obtained by delineating semantic unit boundaries at the semantic transformation point.
[0029] Extract the knowledge content expressed by the initial semantic unit and retrieve the knowledge representation structure corresponding to the knowledge content in the domain knowledge graph. Determine whether the initial semantic unit has independent knowledge expression ability by comparing the knowledge content with the knowledge representation structure.
[0030] Determine whether the subject, predicate, and object components in the initial semantic unit are completely present, and determine whether the initial semantic unit meets the semantic integrity standard based on the determination results of the integrity of the subject, predicate, and object components and the determination results of the independent knowledge expression ability.
[0031] For an initial semantic unit that does not meet the semantic integrity standard, identify the type of missing semantic component in the initial semantic unit, determine the boundary adjustment direction according to the type of missing semantic component, extend the boundary of the semantic unit forward or backward in the boundary adjustment direction to obtain adjacent semantic segments, and merge the adjacent semantic segments into the initial semantic unit to form an adjusted semantic unit.
[0032] The semantic integrity criterion is re-executed for the adjusted semantic unit, and the adjustment of the semantic unit boundary and the determination of the semantic integrity criterion are iteratively executed until the adjusted semantic unit satisfies the semantic integrity criterion and can independently express complete semantics.
[0033] After generating the multi-level semantic units, an endogenous self-verification is triggered. This endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph, verifies the consistency of entity knowledge in the semantic units, and obtains a confidence score and verification conclusion based on the verification result of the entity knowledge consistency and the mapping relationship, including:
[0034] Entity recognition is performed on the semantic unit to be verified to extract the semantic unit entity set, and each entity in the semantic unit entity set is matched with the node in the domain knowledge graph to obtain the matching entity node;
[0035] Extract the association and attribute information of the matching entity nodes in the domain knowledge graph, compare and verify the entity relationships and entity attributes described in the semantic unit to be verified with the association and attribute information respectively, and obtain the verification result of the entity knowledge consistency based on the consistency of the entity relationships and the consistency of the entity attributes.
[0036] Based on the verification results of the entity knowledge consistency, a consistency score is determined and the initial confidence score is obtained by inputting the mapping relationship. Based on the domain fact features and the illusion difference features, the semantic unit to be verified is subjected to feature extraction to obtain a semantic unit feature vector. The similarity between the semantic unit feature vector and the domain fact features and the difference between the semantic unit feature vector and the illusion difference features are calculated to obtain fact similarity score and illusion difference score.
[0037] The confidence score is obtained by weighted fusion of the initial confidence score, the factual similarity score, and the hallucination difference score. The verification conclusion is generated based on the comparison between the confidence score and a preset confidence threshold.
[0038] Based on the confidence score, a grading determination is performed, dividing the generated content into multiple risk levels. Standardized tagged content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic units, forming a tagged professional document including:
[0039] Extract the information points to be verified from the semantic unit to be verified, and trace the association path from the starting entity node corresponding to the information point to the supporting evidence entity node in the domain knowledge graph to obtain the evidence support path;
[0040] Calculate the path length of the evidence support path and the credibility of each node on the evidence support path to determine the path strength of the evidence support path;
[0041] The evidence chain integrity score is calculated based on the number and path strength distribution of all evidence support paths corresponding to all information points to be verified in the semantic unit to be verified. The evidence chain integrity score is then fused with the confidence score to obtain a comprehensive risk assessment value. The risk level and corresponding risk level identifier of the semantic unit to be verified are determined based on the comprehensive risk assessment value.
[0042] The risk level identifier and the verification conclusion are structured to form a labeled data structure. The semantic unit to be verified is located at the end of the semantic unit in the generated content. The labeled data structure is embedded at the end of the semantic unit. After the labeled content is embedded for all semantic units, the labeled professional document is formed.
[0043] A second aspect of the present invention provides a document generation system for large-scale model illusion content endogenous verification and self-labeling, comprising:
[0044] The knowledge graph unit is used to acquire data sources in the target professional field and construct a domain knowledge graph through entity recognition and relation extraction. Based on the domain knowledge graph, a comparative training corpus containing fact samples and hallucination samples is constructed. The target professional field includes generating medical diagnosis descriptions.
[0045] The contrastive training unit is used by the large model to learn the domain factual features and illusion difference features through the contrastive training corpus, establish the mapping relationship between content credibility and confidence score, and embed the structured information of the domain knowledge graph into the model parameters.
[0046] The model embedding unit is used to receive document generation task instructions and decompose them into multiple logically related subtasks, and divide each subtask into multi-level semantic units according to semantic integrity.
[0047] The task decomposition unit is used to trigger endogenous self-verification after generating the multi-level semantic units. The endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph to verify the consistency of entity knowledge in the semantic units, and obtains a confidence score and verification conclusion based on the verification result of the entity knowledge consistency and the mapping relationship.
[0048] The self-verification contact unit is used to perform a graded judgment based on the confidence score, divide the generated content into multiple risk levels, generate standardized marked content containing risk level identifiers and the verification conclusions, and embed it at the end of the corresponding semantic unit to form a marked professional document.
[0049] A third aspect of the present invention,
[0050] An electronic device is provided, comprising:
[0051] processor;
[0052] Memory used to store processor-executable instructions;
[0053] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0054] Fourth aspect of the embodiments of the present invention,
[0055] A computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0056] The beneficial effects of this application are as follows:
[0057] This method embeds an endogenous verification mechanism during document generation, enabling real-time verification of the authenticity of semantic units while content is being generated. This avoids the inefficiency and high correction costs associated with post-generation checks in traditional methods. By breaking down the generation task into multiple logically related subtasks and dividing them into multi-level semantic units based on semantic integrity, it ensures both fine-grained verification and comprehensive coverage of the verification scope.
[0058] By analyzing the number and strength distribution of evidence support paths corresponding to all information points in the semantic unit to be verified, the sufficiency of evidence support and the completeness of knowledge association of the semantic unit can be accurately determined, overcoming the limitation of traditional methods that can only judge the truth or falsehood of content but cannot distinguish different risk levels and their degree of evidence support. By structurally organizing risk level identifiers, verification conclusions, confidence scores, and evidence chain completeness scores and embedding them at the end of the semantic unit, standardized presentation and traceable recording of verification information are achieved.
[0059] This method combines the syntactic structural integrity assessment of semantic units with the knowledge representation capability assessment in the domain knowledge graph, achieving dual verification of semantic unit integrity. For semantic units that do not meet the semantic integrity standard, by identifying the types of missing semantic components and determining the direction of boundary adjustment, it achieves precise expansion and iterative optimization of semantic unit boundaries, ensuring that the final generated semantic units have both complete syntactic structure and independent knowledge representation capability. Attached Figure Description
[0060] Figure 1 This is a flowchart illustrating the self-labeling method for generating endogenous verification of large-scale illusion content in document generation according to an embodiment of the present invention.
[0061] Figure 2 A schematic diagram illustrating the process of constructing and generating a comparative training corpus for cross-modal knowledge graphs. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0064] Figure 1 This is a flowchart illustrating the endogenous verification self-labeling method for generating large-scale illusion content in documents according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes:
[0065] Data sources in the target professional field are acquired and a domain knowledge graph is constructed through entity recognition and relation extraction. A comparative training corpus containing factual samples and hallucination samples is constructed based on the domain knowledge graph. The target professional field includes generating medical diagnosis descriptions.
[0066] The large model learns domain factual features and illusion difference features through the contrastive training corpus, establishes a mapping relationship between content credibility and confidence score, and embeds the structured information of the domain knowledge graph into the model parameters;
[0067] Receive document generation task instructions and break them down into multiple logically related subtasks, and divide each subtask into multi-level semantic units according to semantic integrity;
[0068] After generating the multi-level semantic units, an endogenous self-verification is triggered. The endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph to verify the consistency of entity knowledge in the semantic units. Based on the verification result of the entity knowledge consistency and the mapping relationship, a confidence score and verification conclusion are obtained.
[0069] Based on the confidence score, a classification judgment is performed, the generated content is divided into multiple risk levels, standardized marked content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic unit to form a marked professional document.
[0070] In one optional implementation, data sources from the target professional domain are acquired, and a domain knowledge graph is constructed through entity recognition and relation extraction. Based on the domain knowledge graph, a comparative training corpus containing factual samples and illusion samples is constructed, including:
[0071] By using a cross-modal semantic alignment mechanism, multimodal feature extraction and feature encoding are performed on the text descriptions and structured knowledge carriers in the data source of the target professional field to obtain entity representations of different modalities. By constructing a cross-modal semantic space, entity representations of different modalities are mapped to a unified vector space.
[0072] Based on the semantic similarity in the unified vector space, entity disambiguation and relation completion are performed to construct the domain knowledge graph that integrates multimodal knowledge;
[0073] By using a counterfactual reasoning generation strategy, the causal relationship paths in the domain knowledge graph are logically reversed to generate counterfactual illusion samples that violate domain common sense, the temporal constraint relationship is scrambled to generate anti-temporal logical illusion samples, and the hierarchical belonging relationship is hierarchically cross-grafted to generate anti-classification system illusion samples.
[0074] The counterfactual illusion samples, the counter-temporal logic illusion samples, and the counter-classification system illusion samples are used as deep logic illusion samples. The domain knowledge graph is used to extract entity-relationship-attribute triples to obtain initial knowledge triples, which are then used as fact samples. The deep logic illusion samples and the fact samples together constitute the contrastive training corpus.
[0075] like Figure 2 As shown, the method includes:
[0076] We acquired multi-source heterogeneous data, including clinical practice guidelines, structured data from disease knowledge bases, and medical imaging reports. For the textual description data, we used a Transformer-based encoder to extract contextual semantic features, representing each entity as a 768-dimensional dense vector. For entities in the structured knowledge carriers, we used a graph neural network to aggregate neighborhood topological information, generating structured entity representations of the same dimension. For entity representations of different modalities, we set a contrastive learning loss function with a temperature parameter of 0.07. By minimizing the cosine distance between different modal representations of the same entity while maximizing the discriminative power between different entity representations, we mapped heterogeneous entities to a unified 512-dimensional semantic space.
[0077] In a unified semantic space, cosine similarity is calculated for candidate entity pairs, and entity disambiguation is performed with a threshold of 0.85. For example, when the similarity between the text entity "diabetes" and the entity "type 2 diabetes" in the structured library reaches 0.92, they are determined to be the same entity, and the referential items are merged. To address the missing relationships in the knowledge graph, a relationship completion strategy based on path ranking algorithm is adopted. When there is a two-hop path between the entities "metformin" and "type 2 diabetes" consisting of the intermediate entity "hypoglycemic drugs," a direct treatment relationship is inferred and completed. After entity disambiguation and relationship completion, a medical domain knowledge graph containing 120,000 entity nodes and 350,000 relationship edges is formed.
[0078] The causal path "hypertension → vascular damage → myocardial infarction" in the knowledge graph was logically reversed and rewritten as "myocardial infarction → vascular repair → blood pressure reduction," generating counterfactual samples that violate medical causal logic. The temporal relationship "diabetes diagnosis → blood sugar control → complication prevention" was scrambled to generate a reverse temporal sample of "complication prevention → diabetes diagnosis → blood sugar control." Regarding the hierarchical relationship of "endocrine system diseases → diabetes → type 1 diabetes" in the disease classification system, the lower-level entity "type 1 diabetes" was grafted under the category of "cardiovascular system diseases," constructing a reverse classification system sample. A total of 85,000 deep logical error samples were generated from these three types of illusion samples.
[0079] A triplet extraction operation was performed on the domain knowledge graph to extract entity-relationship-attribute structures in the form of (metformin, applicable to, type 2 diabetes) and (insulin, secretory organ, pancreas), resulting in 230,000 fact triplet samples that conform to domain knowledge. 85,000 deep logic illusion samples were mixed with the 230,000 fact samples at a ratio of 1:2.7 to construct a comparative training corpus containing 315,000 training samples. Each sample was labeled with a veracity tag for subsequent comparative learning training of the model.
[0080] In one optional implementation, the large model learns domain factual features and illusion difference features from the contrastive training corpus to establish a mapping relationship between content credibility and confidence scores, including:
[0081] The domain knowledge graph is encoded using graph structure to generate domain knowledge anchor point representations;
[0082] The system constructs positive and negative sample pairs by combining factual samples and deep logical illusion samples from the contrastive training corpus. The large model encodes the positive and negative sample pairs to obtain sample representations. The distance between the sample representations and the domain knowledge anchor representations is calculated using a contrastive loss function. The system maximizes the similarity between the factual sample representations and the domain knowledge anchor representations and minimizes the similarity between the deep logical illusion sample representations and the domain knowledge anchor representations. The system learns the domain factual features and the illusionary difference features.
[0083] The similarity between the sample representation and the domain fact features is calculated as the factual conformity, and the similarity between the sample representation and the hallucination difference features is calculated as the hallucination deviation. The factual conformity and the hallucination deviation are used as the content credibility feature vector.
[0084] By fitting the nonlinear relationship between the content credibility feature vector distribution and the labeled confidence score of the samples in the comparative training corpus, a mapping rule is established to establish a continuous mapping relationship from the content credibility feature vector to the confidence score.
[0085] A graph neural network is employed to vectorize entity nodes and relation edges in the knowledge graph, encoding the domain knowledge graph's graph structure. Specifically, the attribute information and relational information of each entity node in the knowledge graph are input into a graph convolutional layer, and multi-hop neighbor aggregation is used to capture the structural position features of the entity in the graph. After processing by a three-layer graph convolutional network, each entity node obtains a vector representation that integrates local topological information and global semantic information. For core entities in the knowledge graph, i.e., key nodes with high centrality or connecting multiple domain concepts, their vector representations are extracted as domain knowledge anchor representations. These anchor representations constitute the standard reference system for domain factual knowledge, with a dimension set to a 512-dimensional vector space.
[0086] When constructing positive and negative sample pairs, factual samples are selected as positive samples and deep logical illusion samples as negative samples from the contrastive training corpus. Factual samples refer to descriptive statements that perfectly match the domain knowledge graph, while deep logical illusion samples refer to statements with incorrect entity relationships or causal logic that violates domain common sense. Each pair of positive and negative samples is input into the encoder of the large model, and semantic features of the statements are extracted through a self-attention mechanism. The sample representation vector is obtained in the penultimate hidden layer of the model. When designing the contrastive loss function, a triplet loss mechanism is adopted, using the factual sample representation as an anchor point to shorten its distance from the domain knowledge anchor representation, while simultaneously increasing the distance between the deep logical illusion sample representation and the domain knowledge anchor representation. The boundary parameter in the loss function is set to 0.3 to ensure the spacing between positive and negative samples in the vector space. The model parameters are updated through backpropagation, enabling the model to gradually develop the feature recognition ability to distinguish between facts and illusions. After iterative training, the model establishes a clear decision boundary in the high-dimensional feature space, with factual sample representations clustered in the region close to the domain knowledge anchor representation, and illusion sample representations distributed in the distant region.
[0087] Sample representations of the semantic units to be verified are extracted, and cosine similarity is used to measure the similarity between these representations and domain factual features, with a similarity value range of 0 to 1. When calculating the hallucination deviation, cosine similarity is also used to measure the closeness between the sample representations and hallucination difference features. The factual conformity and hallucination deviation are combined into a two-dimensional vector, which is the content credibility feature vector, where factual conformity occupies the first dimension and hallucination deviation occupies the second dimension. This feature vector comprehensively reflects the degree of consistency between the generated content and domain knowledge, as well as the degree of deviation from typical hallucination patterns.
[0088] We collected and compared the content credibility feature vectors and their corresponding manually labeled confidence scores from all samples in the training corpus. The confidence scores were represented by continuous values from 0 to 100, with higher scores indicating more credible content. A multilayer perceptron network was used to fit the non-linear mapping relationship between the feature vectors and the confidence scores. The network contained two hidden layers, each with 128 neurons, and the ReLU activation function was used. During training, mean squared error was used as the loss function, the Adam algorithm was selected as the optimizer, and the learning rate was set to 0.001. After sufficient training, this mapping network can convert any input content credibility feature vector into a corresponding confidence score, achieving a continuous mapping from a two-dimensional feature space to a one-dimensional score space. This mapping relationship is embedded in the model parameters and can be directly used in subsequent practical validation without additional computational overhead.
[0089] In one optional implementation, receiving a document generation task instruction and breaking it down into multiple logically related subtasks, and dividing each subtask into multi-level semantic units according to semantic integrity, includes:
[0090] The document generation task instructions are semantically parsed to extract task objectives. Dependency analysis is used to identify the pre-dependencies in the task objectives. Based on the pre-dependencies, the necessary preceding sub-tasks are determined.
[0091] The document generation task instruction is broken down into multiple subtasks and a dependency identifier is assigned to each subtask. The dependency identifier records the set of preceding subtasks of the subtask. A directed dependency graph is constructed between the multiple subtasks through the dependency identifier to ensure the logical association between the subtasks.
[0092] Semantic transition points are obtained by calculating the semantic similarity and topic consistency between adjacent semantic segments. Semantic unit boundaries are defined at the semantic transition points. Semantic units are judged according to the semantic integrity standard to determine whether they contain a complete subject-verb-object structure and independent knowledge expression. Semantic units that do not meet the semantic integrity standard are adjusted until the semantic unit can independently express complete semantics.
[0093] Based on the abstraction level of the semantic units, the semantic units are divided into topic-level semantic units, paragraph-level semantic units, and sentence-level semantic units to form a multi-level semantic unit system.
[0094] After receiving the document generation task instruction, the system performs lexical and syntactic analysis on the input instruction to identify verb phrases, noun phrases, and modification relationships, extracting the core task objective. Dependency tree construction technology is used to identify the dependencies between the components of the task objective. When keywords representing preconditions, such as "firstly," "based on," and "according to," are detected, the corresponding content is marked as a pre-dependency. A directed acyclic graph (DAG) algorithm is used to analyze the execution order constraints of the task objective, identifying the content that must be completed first as pre-tasks. For example, when the task instruction is "generate a treatment plan based on the patient's medical history," "obtain the patient's medical history" is identified as a pre-task.
[0095] Based on the extracted task objectives and dependencies, a recursive decomposition strategy is used to break down the document generation task instructions into multiple subtasks. A unique identifier is generated for each subtask, and a dependency identifier data structure is created to record the set of preceding subtasks that the subtask depends on. The dependency identifiers are stored using a hash table, with the subtask identifier as the key and the list of preceding subtask identifiers as the value. The dependency identifiers of all subtasks are traversed, and a directed dependency graph is constructed with subtasks as nodes and dependencies as directed edges. A topological sorting algorithm is used to verify that there are no cycles in the dependency graph, ensuring that the logical relationships between subtasks are reasonable and executable.
[0096] During the generation of each subtask, a sliding window technique is used to calculate the semantic similarity of adjacent semantic segments. Specifically, two adjacent semantic segments are converted into vector representations, and their semantic distance is measured using cosine similarity. Simultaneously, a topic consistency index is calculated, quantified by extracting topic words from the semantic segments and comparing the overlap of topic word sets. When the semantic similarity is below a preset threshold of 0.6 or the topic consistency score is below 0.5, that location is determined as a semantic transition point, and a semantic unit boundary is set at that location.
[0097] The semantic units initially segmented are then subjected to semantic integrity verification. Syntactic analysis is used to check whether each semantic unit contains a complete subject-verb-object structure, and semantic role labeling is used to verify the existence of independent knowledge representations. When a semantic unit lacks a subject or predicate, it is determined that it does not meet the semantic integrity criteria. The semantic unit boundary is then expanded forward or backward, merging adjacent semantic fragments into the unit until a complete semantic expression is formed. For example, if the original semantic unit is "lower blood sugar levels" and lacks a subject, it is expanded forward and merged with "metformin can lower blood sugar levels" to form a complete unit.
[0098] The semantic units are hierarchically classified according to their level of abstraction. Topic-level semantic units correspond to the core argumentative topic of the entire subtask, typically containing more than 200 words of continuous content; paragraph-level semantic units correspond to independent paragraphs, containing 50 to 200 words of logically complete expression; and sentence-level semantic units correspond to a single complete sentence, containing 10 to 50 words of minimal independent semantic meaning. By calculating the character length of each semantic unit, the number of subordinate semantic units it contains, and its hierarchical position in the document structure, level labels are automatically assigned to the semantic units, forming a hierarchical multi-level semantic unit system. This provides fine-grained verification objects for subsequent endogenous self-verification.
[0099] In one optional implementation, semantic unit boundaries are defined at the semantic transition point. A semantic integrity criterion is used to determine whether the semantic unit contains a complete subject-verb-object structure and independent knowledge representation. For semantic units that do not meet the semantic integrity criterion, the semantic unit boundaries are adjusted until the semantic unit can independently express complete semantics. This includes:
[0100] Initial semantic units are obtained by delineating semantic unit boundaries at the semantic transformation point.
[0101] Extract the knowledge content expressed by the initial semantic unit and retrieve the knowledge representation structure corresponding to the knowledge content in the domain knowledge graph. Determine whether the initial semantic unit has independent knowledge expression ability by comparing the knowledge content with the knowledge representation structure.
[0102] Determine whether the subject, predicate, and object components in the initial semantic unit are completely present, and determine whether the initial semantic unit meets the semantic integrity standard based on the determination results of the integrity of the subject, predicate, and object components and the determination results of the independent knowledge expression ability.
[0103] For an initial semantic unit that does not meet the semantic integrity standard, identify the type of missing semantic component in the initial semantic unit, determine the boundary adjustment direction according to the type of missing semantic component, extend the boundary of the semantic unit forward or backward in the boundary adjustment direction to obtain adjacent semantic segments, and merge the adjacent semantic segments into the initial semantic unit to form an adjusted semantic unit.
[0104] The semantic integrity criterion is re-executed for the adjusted semantic unit, and the adjustment of the semantic unit boundary and the determination of the semantic integrity criterion are iteratively executed until the adjusted semantic unit satisfies the semantic integrity criterion and can independently express complete semantics.
[0105] Semantic transition points are monitored in real time within the model output stream. The location of semantic transitions is determined by identifying punctuation marks, logical connectors, and syntactic structure changes. When a period, semicolon, or paragraph end marker is detected, the semantic unit boundary is initially defined at that location, thereby segmenting the continuously generated text stream into multiple initial semantic units.
[0106] For the initial semantic units obtained from the segmentation, a dependency parser is invoked to parse their internal structure. The core knowledge content expressed by the initial semantic unit is extracted, including the entity names, attribute descriptions, and relation types. This extracted knowledge content is used as query conditions to retrieve matching triple structures in the domain knowledge graph. Triples in the knowledge graph are typically stored in the form of "entity-relation-entity" or "entity-attribute-attribute value." The knowledge content of the initial semantic unit is compared with the retrieved knowledge representation structure. If the initial semantic unit can be mapped to a complete triple without missing key information, it is determined to have independent knowledge expression capabilities; if the mapping result has missing entities, ambiguous relations, or missing attribute values, its knowledge expression capabilities are deemed insufficient.
[0107] Simultaneously, syntactic component analysis is performed on the initial semantic unit, locating the subject, predicate, and object components using named entity recognition and semantic role labeling techniques. The subject component typically corresponds to the agent or main entity of the sentence, the predicate component expresses the action or state, and the object component serves as the recipient of the action or provides supplementary information. The system checks whether these three types of components are fully present and have clear referents in the initial semantic unit. For example, in the sentence "According to the patient's medical records, blood pressure is high," the subject component is "medical records," the predicate component is "shows," and the object component is "blood pressure is high." If all three are present, the subject-predicate-object structure is complete. If the initial semantic unit lacks a subject and only contains "shows high blood pressure," then the subject-predicate-object structure is incomplete.
[0108] If both the comprehensive knowledge expression ability assessment result and the subject-verb-object structure integrity assessment result are satisfied, the initial semantic unit is deemed to conform to the semantic integrity standard, and no boundary adjustment is required. If either assessment result is not satisfied, the boundary adjustment process is initiated.
[0109] For initial semantic units that do not meet the semantic completeness criteria, the types of missing semantic components are identified. If a subject is missing, it indicates that the agent or topic of the current semantic unit is in the preceding text, and the boundary adjustment direction is determined to be forward expansion; if an object or supplementary explanation is missing, it is determined that the required information is in the following content, and the boundary adjustment direction is determined to be backward expansion; if the knowledge representation mapping result shows that the relation entity in the triple is missing, the position where the entity should appear is analyzed according to the relation pointers of the knowledge graph, and the expansion direction is determined accordingly.
[0110] Following the determined boundary adjustment direction, adjacent semantic segments are scanned forward or backward from the boundary of the initial semantic unit. When expanding forward, the immediately preceding sentence or clause is acquired as a candidate segment; when expanding backward, subsequent undivided text segments are acquired until the next explicit semantic transition point. The acquired adjacent semantic segments are then concatenated with the initial semantic unit to form the adjusted semantic unit.
[0111] The semantic integrity judgment process is re-executed for the adjusted semantic unit, and the knowledge content is extracted again for knowledge graph mapping check. Simultaneously, the subject-verb-object structural integrity is re-analyzed. If the adjusted semantic unit still does not meet the standard, the expansion direction and segment length of this round of adjustment are recorded. More adjacent content is expanded in the same direction, or the expansion direction is changed to attempt to fill in missing components. Boundary adjustment and integrity judgment are iteratively executed until the adjusted semantic unit can be mapped to a complete knowledge graph structure and possesses a complete subject-verb-object syntactic structure. At this point, the semantic unit is confirmed to meet the semantic integrity standard and can be used as an independent verification object for subsequent hallucination detection.
[0112] In one optional implementation, after generating the multi-level semantic units, an endogenous self-verification is triggered. This endogenous self-verification performs real-time association and matching between the semantic units to be verified and the domain knowledge graph, verifies the consistency of entity knowledge within the semantic units, and obtains a confidence score and verification conclusion based on the verification result of the entity knowledge consistency and the mapping relationship, including:
[0113] Entity recognition is performed on the semantic unit to be verified to extract the semantic unit entity set, and each entity in the semantic unit entity set is matched with the node in the domain knowledge graph to obtain the matching entity node;
[0114] Extract the association and attribute information of the matching entity nodes in the domain knowledge graph, compare and verify the entity relationships and entity attributes described in the semantic unit to be verified with the association and attribute information respectively, and obtain the verification result of the entity knowledge consistency based on the consistency of the entity relationships and the consistency of the entity attributes.
[0115] Based on the verification results of the entity knowledge consistency, a consistency score is determined and the initial confidence score is obtained by inputting the mapping relationship. Based on the domain fact features and the illusion difference features, the semantic unit to be verified is subjected to feature extraction to obtain a semantic unit feature vector. The similarity between the semantic unit feature vector and the domain fact features and the difference between the semantic unit feature vector and the illusion difference features are calculated to obtain fact similarity score and illusion difference score.
[0116] The confidence score is obtained by weighted fusion of the initial confidence score, the factual similarity score, and the hallucination difference score. The verification conclusion is generated based on the comparison between the confidence score and a preset confidence threshold.
[0117] After generating the semantic unit to be verified, the entity recognition module is immediately activated, and the named entity recognition algorithm is used to scan and parse the semantic unit. Taking the medical field as an example, when the semantic unit content is "aspirin is used to relieve angina symptoms", the extracted entity set includes three core entities: "aspirin", "angina", and "relieving effect". Each extracted entity is converted into a standardized representation, and through a combination of string precise matching and semantic similarity calculation, it is compared one by one with the nodes in the domain knowledge graph to locate the corresponding "aspirin" drug node and "angina" disease node in the knowledge graph, thus completing the acquisition of the matching entity nodes.
[0118] For successfully matched entity nodes, complete relational information is extracted from the knowledge graph, including the treatment relationship of "aspirin-indication-angina prevention" and the constraint relationship of "aspirin-contraindications-bleeding tendency." Entity attribute information is also obtained, such as the drug category attribute as "nonsteroidal anti-inflammatory drug" and the dosage attribute as "50-100mg once daily." The description "used to relieve angina symptoms" in the semantic unit to be verified is compared with the "indication is angina prevention" recorded in the knowledge graph. A discrepancy is determined in the therapeutic purpose, indicating partial consistency. When verifying entity attributes, the semantic unit is checked for dosage information; if not explicitly stated, the attribute is marked as insufficient. Combining relational and attribute consistency, the entity knowledge consistency verification result is output, including consistency category labels and detailed difference explanations.
[0119] Based on the consistency categories in the verification results, a segmented scoring mechanism is used to calculate the consistency score. Complete consistency is assigned a value of 1.0, partial consistency is assigned a value of 0.5 to 0.8 depending on the degree of deviation, and inconsistency is assigned a value of 0 to 0.3. This consistency score is input into a mapping function established during the pre-training phase. This mapping is implemented through a neural network, where the hidden layer learns the confidence distribution patterns of domain fact and hallucination samples, outputting an initial confidence score. Simultaneously, deep feature extraction is performed on the semantic units to be verified, using a BERT-like pre-trained model to encode the text into a 768-dimensional feature vector. The cosine similarity of this feature vector with the domain fact feature samples stored during the training phase is calculated to obtain a fact similarity score; the Euclidean distance is calculated with the hallucination difference feature samples and normalized to obtain a hallucination difference score, with a larger value indicating a closer resemblance to the hallucination features.
[0120] A weighted fusion strategy was used to integrate the three scoring dimensions, with the initial confidence score weighted at 0.5, the factual similarity score weighted at 0.3, and the hallucination difference score weighted at 0.2. The calculation formula is S = 0.5 × S init + 0.3 ×S fact + 0.2 × (1 - S hallu The hallucination difference is inverted to ensure consistency in numerical direction. After obtaining the final confidence score, it is compared with the preset multi-level confidence thresholds, which are set as follows: high confidence interval above 0.8, medium confidence interval 0.5 to 0.8, and low confidence interval below 0.5. When the confidence score is 0.62, it is judged as moderately reliable, and the verification conclusion includes a specific explanation of "the entity relationship is partially consistent, and it is recommended to verify the accuracy of the treatment indication," providing a basis for subsequent risk level classification and labeling content generation.
[0121] In one optional implementation, a grading determination is performed based on the confidence score, dividing the generated content into multiple risk levels. Standardized tagged content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic unit, forming a tagged professional document, including:
[0122] Extract the information points to be verified from the semantic unit to be verified, and trace the association path from the starting entity node corresponding to the information point to the supporting evidence entity node in the domain knowledge graph to obtain the evidence support path;
[0123] Calculate the path length of the evidence support path and the credibility of each node on the evidence support path to determine the path strength of the evidence support path;
[0124] The evidence chain integrity score is calculated based on the number and path strength distribution of all evidence support paths corresponding to all information points to be verified in the semantic unit to be verified. The evidence chain integrity score is then fused with the confidence score to obtain a comprehensive risk assessment value. The risk level and corresponding risk level identifier of the semantic unit to be verified are determined based on the comprehensive risk assessment value.
[0125] The risk level identifier and the verification conclusion are structured to form a labeled data structure. The semantic unit to be verified is located at the end of the semantic unit in the generated content. The labeled data structure is embedded at the end of the semantic unit. After the labeled content is embedded for all semantic units, the labeled professional document is formed.
[0126] For the semantic unit to be verified, a refined extraction at the information point level is first performed. Through syntactic parsing and semantic analysis of the semantic unit, all information points to be verified are identified, each corresponding to a core statement or key fact. For the information point to be verified, "a certain drug is suitable for treating hypertension," "a certain drug" is identified as the starting entity node. Through the pre-established drug-indication relationship network in the domain knowledge graph, the indication entity node pointed to by the drug entity is traced. The tracing process unfolds layer by layer along the graph edge relationships. When the endpoint node of the path is "hypertension" and this node is labeled with authoritative evidence sources, this node is the supporting evidence entity node, and the entire path constitutes the evidence support path.
[0127] The path strength quantification for evidence-supporting paths employs a two-factor comprehensive calculation method. Path length is obtained by counting the number of edges traversed between the starting entity node and the supporting evidence entity node; a shorter path indicates a more direct association. The credibility of each node is pre-assigned during the domain knowledge graph construction phase. This value is calculated based on the authority and timeliness of the data source, ranging from 0 to 1. The path strength calculation uses the path length as a penalty term in the denominator and the geometric mean of the credibility of all nodes on the path as an enhancement term in the numerator. After normalization, a path strength score between 0 and 1 is obtained.
[0128] When a semantic unit to be verified contains 5 information points to be verified, the corresponding evidence support paths are traced back to each. Statistical analysis reveals that 3 information points each correspond to a single path, while the other 2 information points each correspond to two parallel paths. The calculation of the evidence chain integrity score must consider both path coverage and quality distribution. Coverage is calculated by the percentage of information points successfully traced back to evidence support paths, while quality distribution is represented by the weighted average of the strengths of all paths. The coverage and weighted average path strength are linearly combined using preset weighting coefficients to obtain the evidence chain integrity score. This score reflects the degree of factual support for the semantic unit.
[0129] The comprehensive risk assessment value integrates the evidence chain integrity score and the confidence score using a fusion mechanism. The confidence score has already been generated in the preliminary verification stage based on entity knowledge consistency verification and model mapping relationship. A fusion weighting coefficient is set, multiplying the evidence chain integrity score by 0.6 and the confidence score by 0.4, and the two are summed to obtain the comprehensive risk assessment value. This assessment value is also normalized to the range of 0 to 1, with higher values indicating stronger content credibility.
[0130] Risk level classification adopts a threshold-based strategy. Three preset threshold boundaries are used: a comprehensive risk assessment value greater than or equal to 0.8 is classified as low risk (corresponding to a green label); values between 0.5 and 0.8 are classified as medium risk (corresponding to a yellow label); and values below 0.5 are classified as high risk (corresponding to a red label). Risk level labels are represented using a combination of predefined color codes and icon symbols.
[0131] The tagged data structure is organized using a lightweight structured format. This structure includes a risk level identifier field, a verification conclusion text field, an evidence support path summary field, and a timestamp field. The verification conclusion text describes the degree of factual conformity of the semantic unit, while the evidence support path summary lists key evidence nodes in a concise form. The end position of a semantic unit is located by its closing punctuation mark, after which the tagged data structure is inserted. The tagged content is enclosed in specific delimiters to ensure clear distinction from the main text. After traversing and processing all semantic units to be verified, the corresponding tagged data structure is embedded at the end of each semantic unit in the original generated content, forming a tagged professional document that integrates content and verification information. This document can be directly used by users to quickly identify the credibility of the content during review.
[0132] A third aspect of the present invention provides an electronic device, comprising:
[0133] processor;
[0134] Memory used to store processor-executable instructions;
[0135] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0136] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0137] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0138] 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 the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A document generation method for large-scale model illusion content endogenous verification and self-labeling, characterized in that, include: Data sources in the target professional field are acquired and a domain knowledge graph is constructed through entity recognition and relation extraction. A comparative training corpus containing factual samples and hallucination samples is constructed based on the domain knowledge graph. The target professional field includes generating medical diagnosis descriptions. The large model learns domain factual features and illusion difference features through the contrastive training corpus, establishes a mapping relationship between content credibility and confidence score, and embeds the structured information of the domain knowledge graph into the model parameters; Receive document generation task instructions and break them down into multiple logically related subtasks, and divide each subtask into multi-level semantic units according to semantic integrity; After generating the multi-level semantic units, an endogenous self-verification is triggered. The endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph to verify the consistency of entity knowledge in the semantic units. Based on the verification result of the entity knowledge consistency and the mapping relationship, a confidence score and verification conclusion are obtained. Based on the confidence score, a classification judgment is performed, the generated content is divided into multiple risk levels, standardized marked content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic unit to form a marked professional document.
2. The method according to claim 1, characterized in that, Data sources in the target professional field are acquired, and a domain knowledge graph is constructed through entity recognition and relation extraction. Based on the domain knowledge graph, a comparative training corpus containing factual samples and illusion samples is constructed, including: By using a cross-modal semantic alignment mechanism, multimodal feature extraction and feature encoding are performed on the text descriptions and structured knowledge carriers in the data source of the target professional field to obtain entity representations of different modalities. By constructing a cross-modal semantic space, entity representations of different modalities are mapped to a unified vector space. Based on the semantic similarity in the unified vector space, entity disambiguation and relation completion are performed to construct the domain knowledge graph that integrates multimodal knowledge; By using a counterfactual reasoning generation strategy, the causal relationship paths in the domain knowledge graph are logically reversed to generate counterfactual illusion samples that violate domain common sense, the temporal constraint relationship is scrambled to generate anti-temporal logical illusion samples, and the hierarchical belonging relationship is hierarchically cross-grafted to generate anti-classification system illusion samples. The counterfactual illusion samples, the counter-temporal logic illusion samples, and the counter-classification system illusion samples are used as deep logic illusion samples. The domain knowledge graph is used to extract entity-relationship-attribute triples to obtain initial knowledge triples, which are then used as fact samples. The deep logic illusion samples and the fact samples together constitute the contrastive training corpus.
3. The method according to claim 1, characterized in that, The large model learns domain factual features and hallucination difference features through the aforementioned contrastive training corpus, and establishes a mapping relationship between content credibility and confidence score, including: The domain knowledge graph is encoded using graph structure to generate domain knowledge anchor point representations; The system constructs positive and negative sample pairs by combining factual samples and deep logical illusion samples from the contrastive training corpus. The large model encodes the positive and negative sample pairs to obtain sample representations. The distance between the sample representations and the domain knowledge anchor representations is calculated using a contrastive loss function. The system maximizes the similarity between the factual sample representations and the domain knowledge anchor representations and minimizes the similarity between the deep logical illusion sample representations and the domain knowledge anchor representations. The system learns the domain factual features and the illusionary difference features. The similarity between the sample representation and the domain fact features is calculated as the factual conformity, and the similarity between the sample representation and the hallucination difference features is calculated as the hallucination deviation. The factual conformity and the hallucination deviation are used as the content credibility feature vector. By fitting the nonlinear relationship between the content credibility feature vector distribution and the labeled confidence score of the samples in the comparative training corpus, a mapping rule is established to establish a continuous mapping relationship from the content credibility feature vector to the confidence score.
4. The method according to claim 1, characterized in that, The system receives document generation task instructions and breaks them down into multiple logically related subtasks. Each subtask is then divided into multi-level semantic units based on semantic integrity, including: The document generation task instructions are semantically parsed to extract task objectives. Dependency analysis is used to identify the pre-dependencies in the task objectives. Based on the pre-dependencies, the necessary preceding sub-tasks are determined. The document generation task instruction is broken down into multiple subtasks and a dependency identifier is assigned to each subtask. The dependency identifier records the set of preceding subtasks of the subtask. A directed dependency graph is constructed between the multiple subtasks through the dependency identifier to ensure the logical association between the subtasks. Semantic transition points are obtained by calculating the semantic similarity and topic consistency between adjacent semantic segments. Semantic unit boundaries are defined at the semantic transition points. Semantic units are judged according to the semantic integrity standard to determine whether they contain a complete subject-verb-object structure and independent knowledge expression. Semantic units that do not meet the semantic integrity standard are adjusted until the semantic unit can independently express complete semantics. Based on the abstraction level of the semantic units, the semantic units are divided into topic-level semantic units, paragraph-level semantic units, and sentence-level semantic units to form a multi-level semantic unit system.
5. The method according to claim 4, characterized in that, At the semantic transition point, semantic unit boundaries are defined. Based on the semantic integrity standard, it is determined whether the semantic unit contains a complete subject-verb-object structure and independent knowledge representation. For semantic units that do not meet the semantic integrity standard, the semantic unit boundaries are adjusted until the semantic unit can independently express complete semantics, including: Initial semantic units are obtained by delineating semantic unit boundaries at the semantic transformation point. Extract the knowledge content expressed by the initial semantic unit and retrieve the knowledge representation structure corresponding to the knowledge content in the domain knowledge graph. Determine whether the initial semantic unit has independent knowledge expression ability by comparing the knowledge content with the knowledge representation structure. Determine whether the subject, predicate, and object components in the initial semantic unit are completely present, and determine whether the initial semantic unit meets the semantic integrity standard based on the determination results of the integrity of the subject, predicate, and object components and the determination results of the independent knowledge expression ability. For an initial semantic unit that does not meet the semantic integrity standard, identify the type of missing semantic component in the initial semantic unit, determine the boundary adjustment direction according to the type of missing semantic component, extend the boundary of the semantic unit forward or backward in the boundary adjustment direction to obtain adjacent semantic segments, and merge the adjacent semantic segments into the initial semantic unit to form an adjusted semantic unit. The semantic integrity criterion is re-executed for the adjusted semantic unit, and the adjustment of the semantic unit boundary and the determination of the semantic integrity criterion are iteratively executed until the adjusted semantic unit satisfies the semantic integrity criterion and can independently express complete semantics.
6. The method according to claim 1, characterized in that, After generating the multi-level semantic units, an endogenous self-verification is triggered. This endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph, verifies the consistency of entity knowledge in the semantic units, and obtains a confidence score and verification conclusion based on the verification result of the entity knowledge consistency and the mapping relationship, including: Entity recognition is performed on the semantic unit to be verified to extract the semantic unit entity set, and each entity in the semantic unit entity set is matched with the node in the domain knowledge graph to obtain the matching entity node; Extract the association and attribute information of the matching entity nodes in the domain knowledge graph, compare and verify the entity relationships and entity attributes described in the semantic unit to be verified with the association and attribute information respectively, and obtain the verification result of the entity knowledge consistency based on the consistency of the entity relationships and the consistency of the entity attributes. Based on the verification results of the entity knowledge consistency, a consistency score is determined and the initial confidence score is obtained by inputting the mapping relationship. Based on the domain fact features and the illusion difference features, the semantic unit to be verified is subjected to feature extraction to obtain a semantic unit feature vector. The similarity between the semantic unit feature vector and the domain fact features and the difference between the semantic unit feature vector and the illusion difference features are calculated to obtain fact similarity score and illusion difference score. The confidence score is obtained by weighted fusion of the initial confidence score, the factual similarity score, and the hallucination difference score. The verification conclusion is generated based on the comparison between the confidence score and a preset confidence threshold.
7. The method according to claim 1, characterized in that, Based on the confidence score, a grading determination is performed, dividing the generated content into multiple risk levels. Standardized tagged content containing risk level identifiers and the verification conclusions is generated and embedded at the end of the corresponding semantic units, forming a tagged professional document including: Extract the information points to be verified from the semantic unit to be verified, and trace the association path from the starting entity node corresponding to the information point to the supporting evidence entity node in the domain knowledge graph to obtain the evidence support path; Calculate the path length of the evidence support path and the credibility of each node on the evidence support path to determine the path strength of the evidence support path; The evidence chain integrity score is calculated based on the number and path strength distribution of all evidence support paths corresponding to all information points to be verified in the semantic unit to be verified. The evidence chain integrity score is then fused with the confidence score to obtain a comprehensive risk assessment value. The risk level and corresponding risk level identifier of the semantic unit to be verified are determined based on the comprehensive risk assessment value. The risk level identifier and the verification conclusion are structured to form a labeled data structure. The semantic unit to be verified is located at the end of the semantic unit in the generated content. The labeled data structure is embedded at the end of the semantic unit. After the labeled content is embedded for all semantic units, the labeled professional document is formed.
8. A document generation system for endogenous verification and self-labeling of large-scale model illusion content, used to implement the method as described in any one of claims 1-7, characterized in that, include: The knowledge graph unit is used to acquire data sources in the target professional field and construct a domain knowledge graph through entity recognition and relation extraction. Based on the domain knowledge graph, a comparative training corpus containing fact samples and hallucination samples is constructed. The target professional field includes generating medical diagnosis descriptions. The contrastive training unit is used by the large model to learn the domain factual features and illusion difference features through the contrastive training corpus, establish the mapping relationship between content credibility and confidence score, and embed the structured information of the domain knowledge graph into the model parameters. The model embedding unit is used to receive document generation task instructions and decompose them into multiple logically related subtasks, and divide each subtask into multi-level semantic units according to semantic integrity. The task decomposition unit is used to trigger endogenous self-verification after generating the multi-level semantic units. The endogenous self-verification performs real-time association matching between the semantic units to be verified and the domain knowledge graph to verify the consistency of entity knowledge in the semantic units, and obtains a confidence score and verification conclusion based on the verification result of the entity knowledge consistency and the mapping relationship. The self-verification contact unit is used to perform a graded judgment based on the confidence score, divide the generated content into multiple risk levels, generate standardized marked content containing risk level identifiers and the verification conclusions, and embed it at the end of the corresponding semantic unit to form a marked professional document.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Large model illusion evaluation data generation method
CN119622001A
Knowledge cross validation question and answer method and system for reducing illusion of large language model
CN120910218A
Online question and answer illusion detection method based on knowledge graph and multi-stage fusion
CN121235125A
LLM-based constraint and self-repairing uniformization equipment knowledge graph automatic construction method
CN121413730A
Systems and methods for detection of hallucination in large language models
US20250356197A1