A Data Augmentation Method and System for Precise Question Answering Based on Knowledge Graph Annotation
By constructing a hierarchical knowledge graph and performing entity replacement and relation path transformation, logically rigorous medical question-answer pairs are generated, solving the problems of high labor costs and data sparsity in existing technologies, and achieving efficient data expansion and semantic accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-07-31
AI Technical Summary
Existing medical question-answering data annotation methods suffer from high labor costs, difficulty in protecting privacy, sparse data, and semantic inaccurate generated question-answer pairs in medical scenarios, especially in question-answering samples of long-tail diseases and rare symptoms.
Based on knowledge graphs, a hierarchical semantic structure is constructed. A structured graph query pattern is generated through medical named entity recognition and entity relationship parsing. Entity replacement and relationship path transformation are performed. Combined with a natural language generator, logically rigorous question-answer pairs are automatically generated and validated through attribute range, relationship mutual exclusion, and path legality constraints.
While maintaining the accuracy of medical semantics, it automatically generates logically rigorous and diverse question-and-answer pairs, effectively expanding training data and significantly reducing the cost of manual annotation.
Smart Images

Figure CN122491516A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a precise question-answering data augmentation method and system based on knowledge graph annotation. Background Technology
[0002] In recent years, with the deepening application of artificial intelligence in the medical field, natural language-based precise question-answering systems have become important tools to assist doctors in diagnosis and serve patient consultations. Such systems typically rely on large-scale, high-quality question-and-answer labeled datasets for model training. However, question-answering data labeling in the medical field faces three major challenges: First, medical knowledge is highly specialized, requiring the participation of senior clinicians or pharmaceutical experts, resulting in extremely high human resource costs; second, real doctor-patient question-and-answer data involves patient privacy, making it difficult to obtain and subject to strict compliance requirements; third, existing publicly available medical question-and-answer datasets are limited in size, and the question-and-answer samples corresponding to long-tail diseases and rare symptoms are extremely sparse.
[0003] Traditional data augmentation methods, such as synonym replacement, back-translation, and random insertion / deletion, while capable of scaling up data, exhibit significant shortcomings in medical contexts. Firstly, these methods readily compromise the precision of medical terminology (e.g., replacing "mitral stenosis" with "heart valve narrowing," leading to semantic distortion). Secondly, they fail to guarantee the logical consistency of generated question-and-answer pairs, potentially resulting in factual errors such as "the question asks for symptoms of hypertension, while the answer describes medication for diabetes." Therefore, a data augmentation method that maintains both the accuracy of medical semantics and the rigor of question-and-answer logic is urgently needed. Summary of the Invention
[0004] The purpose of this invention is to provide a precise question-answering data augmentation method and system based on knowledge graph annotation, which can automatically generate logically rigorous and content-diverse precise question-answer pairs while maintaining the accuracy of medical semantics, effectively expanding medical question-answering training data, and significantly reducing the cost of manual annotation.
[0005] To achieve the above objectives, in a first aspect, the present invention provides a precise question-answering data augmentation method based on knowledge graph annotation, comprising the following steps:
[0006] Medical entities, entity attributes, and relationships between entities are extracted from legally authorized multi-source medical knowledge bases. Based on the extracted three elements, a hierarchical semantic graph structure containing a type layer and an instance layer is constructed for medical knowledge graphs.
[0007] A medical named entity recognition model is used to identify and anchor medical entities from the question and answer texts of seed question-answer pairs, and the question intent is parsed to anchor the relationship type, generating a structured graph query pattern. The graph query pattern includes a question anchor entity set, an anchor relationship type, and an answer anchor entity set.
[0008] Based on the graph query pattern, entity replacement deformation and / or relation path deformation are performed on the medical knowledge graph to generate multiple derived query patterns. In the entity replacement deformation, the anchor relation type is kept unchanged while the entity is replaced. In the relation path deformation, the entity is kept unchanged while the semantically equivalent path sequence is replaced.
[0009] Each derived query pattern is converted into natural language question and answer text by a natural language generator to form an enhanced question-answer pair.
[0010] We use predefined attribute range constraints, relation mutual exclusion constraints, and path validity constraints in the medical knowledge graph to validate the augmented question-answer pairs, and include the question-answer pairs that pass all constraints into the augmented training dataset.
[0011] The construction of the medical knowledge graph specifically includes: obtaining raw data from publicly available or authorized medical guidelines, textbooks, and anonymized databases; using a deep learning-based hybrid extraction pipeline to extract medical entities, entity attributes, and relationships between entities; and resolving conflicting triples using a voting mechanism based on the strength of evidence. The construction process employs a hierarchical semantic graph structure, separating the type layer from the instance layer. The type layer stores the superclass-subclass relationships of medical concepts, while the instance layer stores specific entities and their attributes and relationships. Instantiated edges connect the two layers.
[0012] The medical named entity recognition model includes a character-level feature encoding layer, a contextual semantic fusion layer, and a type constraint output layer. The type constraint output layer introduces a medical type constraint matrix, which is derived from the type layer of the medical knowledge graph and defines the compatibility and mutual exclusion between different semantic types. The model uses a conditional random field decoder combined with the constraint matrix to search for the globally optimal entity type label sequence.
[0013] Among them, the anchoring of medical entities adopts a multi-stage matching strategy, using the thesaurus and graph distance between other anchored entities in the context for disambiguation; parsing the question intent maps the question text to a predefined relation type in the knowledge graph as the anchor relation type.
[0014] The entity replacement transformation includes: using the type layer of the medical knowledge graph, constructing a candidate entity space for each entity in the original query pattern, which contains sibling entities sharing the same direct parent type and descendant entities with the same semantic type; performing a replacement compatibility judgment on each candidate replacement combination, checking whether the new question anchor entity set and the new answer anchor entity set after replacement can still be connected in the knowledge graph through the anchor relationship type; and generating a new derived query pattern from the replacement combinations that pass the judgment.
[0015] Among them, relational path transformation includes: equivalent path mining and path instantiation;
[0016] Equivalent path mining is based on a predefined set of equivalence rules and graph structure statistical methods to obtain semantically equivalent path patterns from question entity types to answer entity types, and performs logical consistency checks on candidate path patterns. When a path is instantiated, while keeping the question anchor entity set and the answer anchor entity set unchanged, the original anchor relationship type is replaced with a specific instance path, and the intermediate nodes on this path are retained as implicit constraints in the derived query pattern.
[0017] The natural language generator includes a syntactic template library, an entity name normalization module, a path sequence to sentence decoder, and an answer synthesizer. The path sequence to sentence decoder uses a headword anchoring strategy to identify core relations from the relation path sequence as the main template, and embeds other relations as modifiers to generate question text. The entity name normalization module converts standardized concept names in the knowledge graph into clinically common expressions. The answer synthesizer dynamically outputs the format according to the cardinality of the answer anchor entity set, and outputs yes or no for empty sets and yes / no questions.
[0018] Among them, the attribute range constraint validation is used to verify whether the numerical or enumerated attribute values mentioned in the question-answer pair are within the legal range of the corresponding entity in the knowledge graph;
[0019] Mutual exclusion constraint validation is used to detect whether a question-answer pair contains logically mutually exclusive relation types or combinations of relation instances.
[0020] The path validity constraint verification includes connectivity verification and semantic consistency verification. It requires that the path in the derived query pattern must belong to the predefined legal path whitelist, and that each entity in the question anchor entity set can reach at least one entity in the answer anchor entity set along the path.
[0021] The method further includes:
[0022] For augmented question-answer pairs that fail the path validity constraint, they are sent to the review queue for manual review and reverse correction of the knowledge graph or the valid path whitelist; augmented question-answer pairs that fail the attribute range constraint or relation mutual exclusion constraint are discarded directly.
[0023] Secondly, the present invention provides a precise question-answering data augmentation system based on knowledge graph annotation, applied to a precise question-answering data augmentation method based on knowledge graph annotation as provided in the first aspect, comprising:
[0024] The medical knowledge graph construction module is used to extract medical entities, entity attributes, and relationships between entities from legally authorized multi-source medical knowledge bases, and to construct a hierarchical semantic graph structure containing type layers and instance layers based on the extracted three elements.
[0025] The graph annotation module is used to identify and anchor medical entities from the question and answer texts of seed question-answer pairs using a medical named entity recognition model, parse the question intent to anchor the relationship type, and generate a structured graph query pattern.
[0026] The semantic equivalence transformation module is used to perform entity replacement transformation and / or relation path transformation on the medical knowledge graph based on the graph query pattern, and generate multiple derived query patterns.
[0027] The natural language generation module is used to convert each derived query pattern into natural language question text and answer text through a natural language generator, forming an enhanced question-answer pair.
[0028] The confidence filtering module is used to validate augmented question-answer pairs using predefined attribute range constraints, relation mutual exclusion constraints, and path validity constraints in the medical knowledge graph, and to include question-answer pairs that pass all constraints into the augmented training dataset.
[0029] This invention discloses a precise question-answering data augmentation method and system based on knowledge graph annotation. First, a hierarchical medical knowledge graph containing type and instance layers is constructed. Then, a medical named entity recognition model is used to annotate seed question-answer pairs on the knowledge graph, generating structured graph query patterns. Next, entity substitution and relation path transformations are performed on the knowledge graph to generate multiple semantically equivalent derived query patterns. These are then converted into natural language question-answer pairs using a natural language generator. Finally, confidence filtering is performed based on attribute range constraints, relation mutual exclusion constraints, and path validity constraints. This invention can automatically generate logically rigorous and content-diverse precise question-answer pairs while maintaining the accuracy of medical semantics, effectively expanding medical question-answering training data and significantly reducing manual annotation costs. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0031] Figure 1 This is a schematic diagram illustrating the steps of a precise question-answering data augmentation method based on knowledge graph annotation according to the first embodiment of the present invention.
[0032] Figure 2 This is a flowchart illustrating a precise question-answering data augmentation method based on knowledge graph annotation provided by the present invention.
[0033] Figure 3 This is a structural principle diagram of a precise question-answering data augmentation system based on knowledge graph annotation, according to the second embodiment of the present invention.
[0034] Figure 4 This is a schematic diagram of the electronic device of the present invention.
[0035] In the diagram: 101-Medical knowledge graph construction module, 102-Graph annotation module, 103-Semantic equivalence transformation module, 104-Natural language generation module, 105-Confidence filtering module. Detailed Implementation
[0036] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.
[0037] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0038] It should be understood that although the terms first, second, third, etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0039] The first embodiment of this application is as follows:
[0040] Please see Figures 1-2 This invention provides a precise question-answering data augmentation method based on knowledge graph annotation, comprising the following steps:
[0041] S1. Extract medical entities, entity attributes, and relationships between entities from a legally authorized multi-source medical knowledge base. Based on the extracted three elements, construct a hierarchical semantic graph structure containing a type layer and an instance layer.
[0042] Specifically, to ensure the practical deployability of the method in clinical and commercial environments, data acquisition strictly adheres to intellectual property protection and medical ethics guidelines. All raw data originates from the following three categories of authoritative medical knowledge sources that have been publicly disclosed or licensed:
[0043] Category 1: Published medical guidelines and textbooks without copyright disputes, including national clinical practice guidelines, drug formularies, and medical textbooks. These texts are usually published by official institutions or academic groups, explicitly allowing non-commercial information extraction and secondary use.
[0044] The second category includes publicly available medical databases that have undergone anonymization, such as drug approval information databases and disease classification coding systems. Before use, it is necessary to confirm that their terms of use allow for automated knowledge extraction and strictly prohibit the inclusion of any personally identifiable information.
[0045] The third category involves obtaining clinical pathway documents or hospital internal knowledge bases through legal authorization. After obtaining written authorization from the data provider and signing a data usage agreement, only general medical knowledge unrelated to specific patients (such as standard diagnostic procedures and drug incompatibilities) is extracted, completely avoiding privacy risks.
[0046] During the data collection phase, a copyright verification mechanism based on digital fingerprints is employed: each document source is uniquely identified and hashed to ensure that any subsequently generated knowledge fragments can be traced back to their original copyright source. Simultaneously, a compliance filter is established to automatically remove paragraphs containing sensitive words or potentially containing patient information. This step does not retain any full-text copies of the original documents; only extracted and anonymized structured triples are stored.
[0047] From the legally obtained text and structured data, a hybrid extraction pipeline incorporating medical ontology constraints was used to extract three core elements: medical entities, entity attributes, and relationships between entities. All extraction operations were anchored to standard medical semantic types to ensure the accuracy and interoperability of the elements.
[0048] Medical entities refer to concepts with independent clinical significance, such as diseases, symptoms, drugs, examinations, and surgical procedures. The extraction process consists of two steps:
[0049] First, a deep learning-based medical named entity recognition model is used to perform sequence labeling on the original text. This model uses pre-trained medical language representations as underlying features and is fine-tuned on a large-scale labeled medical corpus, effectively recognizing long terms (e.g., "acute coronary syndrome") and nested entities (e.g., "ventricle" in "left ventricular ejection fraction"). The model's output is an entity type label for each word segment.
[0050] Secondly, an entity standardization module is introduced to map the identified raw strings to unique concept identifiers in the standard medical ontology. This module constructs a mapping dictionary consisting of a thesaurus, an abbreviation table, and hierarchical category constraints. For each candidate string, its semantic similarity to the standard concept name is calculated, and the candidate list is pruned using the semantic type in the context of the string (such as "disease" or "symptom"). Finally, the standard concept that meets the type constraints and has the highest similarity is selected as the official identifier of the entity.
[0051] Entity attributes describe the intrinsic characteristics of a medical entity, such as the typical incubation period range of a disease or the maximum daily dose of a drug. Attribute extraction employs a combination of template-based and long-range supervision: a set of syntactic templates expressing attribute relationships are pre-constructed (e.g., "the incubation period of [disease] is generally [time]"), and these templates are matched against the text to directly capture attribute triples. For cases not covered by the templates, an existing structured knowledge base (such as structured fields in drug instructions) is used as a long-range supervision signal to train an attribute classifier capable of determining whether an attribute dependency relationship exists between two mentions. Each attribute is ultimately represented as an attribute name-value pair and associated with the corresponding medical entity node.
[0052] Inter-entity relations characterize the semantic connections between two medical entities, such as "disease A treats drug B" and "symptom C occurs in disease D". Relation extraction employs a joint extraction model based on graph convolutional networks. This model co-encodes the word sequence in the sentence and the identified entity positions, constructing a sentence-level graph containing entity nodes and potential relation edges. Through multiple rounds of information passing on this graph, the model can simultaneously predict whether a relation exists between entity pairs and the specific type of the relation. To improve the accuracy of relation extraction in the medical field, this method embeds a relation type constraint matrix into the model. This matrix is derived from the relation hierarchy defined in the medical knowledge base (e.g., the "treat" relation cannot appear in the "cause" relation group), thereby effectively suppressing impossible relation predictions.
[0053] After the three key elements are extracted, the process moves to the knowledge graph construction and storage phase. The core innovation of this phase lies in the adoption of a "hierarchical semantic graph" structure, which organizes entities, attributes, and relationships in a multi-level manner with confidence level labels.
[0054] Each medical entity is defined as a node in the graph, and the node ID uses a standardized conceptual identifier. Entity attributes are not stored as independent nodes, but as additional attributes of the nodes to improve query efficiency. Each entity node is accompanied by a meta-information tag that records its semantic type (such as "disease" or "drug") and source traceability identifier (from which original document).
[0055] Each relationship between entities is defined as a directed edge, pointing from the subject entity to the object entity. The edge label takes the value of a predefined relationship type (e.g., "represents", "treatment", "diagnosis"). For relationships extracted directly from the text, the edge also includes an extraction confidence score (given by the extraction model). For relationships obtained from structured knowledge sources, the confidence score is set to the highest value.
[0056] To enhance the reasoning ability and noise resistance of the graph, this invention explicitly adds two abstract semantic layers to the graph: a type layer and an instance layer. The type layer retains only the superclass-subclass relationships of medical concepts (i.e., "is a" relationships), forming a medical classification tree. The instance layer stores specific medical entities and their attributes and relationships. The type layer and the instance layer are connected by "instantiation" edges, allowing each instance layer node to generalize upwards along the type layer. This hierarchical structure ensures that subsequent entity replacement and transformation operations strictly adhere to the semantic distance of the medical classification system, avoiding erroneous replacement of entities from different semantic categories.
[0057] Because multi-source data extraction may generate conflicting information (e.g., the same entity has different attribute values in different texts), this method establishes a consistency verification module. This module verifies each candidate triple based on predefined conflict detection rules in the medical field (e.g., "dosage ranges cannot overlap," "same drug, different names but the same code"). For detected conflicts, a voting mechanism based on the strength of evidence is introduced: each conflict candidate is weighted according to the authority level of its source (official guidelines are higher than textbooks, textbooks are higher than general literature) and the confidence level of the extraction model, and the candidate with the highest score is adopted. Unadopted conflict triples are not discarded but are stored in a queue for periodic review by human experts.
[0058] The final medical knowledge graph is physically stored in a graph database, supporting efficient neighborhood queries and multi-hop path traversal. The graph maintains an incremental update interface, allowing new nodes, relationships, or modifications to the confidence levels of existing attributes to be added in batches after new, valid data is obtained. Each update generates a version number to ensure the reproducibility of the enhancement experiments.
[0059] Through the close coordination of the above three sub-steps, this invention obtains a high-quality, traceable medical knowledge graph that supports logical reasoning. This graph not only provides reliable semantic anchors for subsequent question-answering data enhancement, but its hierarchical structure and conflict resolution mechanism also constitute innovative features that distinguish it from general knowledge graph construction methods.
[0060] S2. Using a medical named entity recognition model, identify and anchor medical entities from the question and answer texts of the seed question-answer pair, parse the question intent to anchor the relationship type, and generate a structured graph query pattern. The graph query pattern includes a question anchor entity set, an anchor relationship type, and an answer anchor entity set.
[0061] Specifically, the medical named entity recognition model constructed in this invention is a hierarchical neural semantic parser, whose architecture consists of three sequentially connected sub-modules: a character-level feature encoding layer, a contextual semantic fusion layer, and a type constraint output layer. The input of this model is the original character sequence of the question text or answer text in a seed question-answer pair, and the output is the medical entity boundary and its semantic type label corresponding to each character position.
[0062] This layer is responsible for converting each character in the input text into a high-dimensional vector representation. It employs sub-word embedding technology to segment the character sequence into sub-word units commonly found in medical corpora (e.g., roots, prefixes, suffixes), effectively handling the complex morphological variations and spelling variants of medical terms. Each sub-word unit's vector is composed of three parts: a pre-trained vector from a general language model, a fine-tuned vector from the medical domain corpus, and a positional encoding vector representing the character's position within the word (beginning, middle, or end). This layer outputs a vector sequence of the same length as the input character sequence.
[0063] This layer employs a bidirectional deep network structure to interact with contextual information in character-level vector sequences. The network consists of multiple stacked transformation units, each containing a self-attention mechanism and a feedforward fully connected sublayer. The self-attention mechanism enables the representation at each position to perceive the semantic contributions of all other positions in the entire sentence, and is particularly adept at capturing long-distance dependencies common in medical texts (such as cross-phrase modifications between symptoms and corresponding diseases). After multiple transformations, this layer outputs a character representation sequence that incorporates bidirectional contextual information.
[0064] This layer is one of the innovative aspects of the model in this invention. Traditional entity recognition models predict the label for each character independently, which can easily lead to outputs that conflict with the medical ontology (e.g., labeling "hypertension" as both a disease and a symptom). This invention introduces a medical type constraint matrix into the output layer. This matrix is pre-derived from the type layer of the medical knowledge graph constructed in the first step, defining the compatibility and mutual exclusion between different semantic types. Specifically, for each character position, the model first calculates the original probability distribution of its belonging to each entity type label; then, using a conditional random field-based decoder, the transition probability matrix of the decoder is replaced with legal transition weights derived from the medical type constraint matrix—the transition probability is non-zero only when transitioning from one type to another is permitted within the medical ontology. The decoder searches for the globally optimal label sequence using the Viterbi algorithm, ensuring that the entity type labeling results for the entire sentence conform to the type hierarchy logic in the medical knowledge graph. The output of this layer is text labeled with entity boundaries and types (e.g., "disease," "symptom," "medicine").
[0065] Knowledge graph annotation refers to establishing a one-to-one correspondence between the natural language text in the seed question-answer pairs and the nodes and edges in the medical knowledge graph constructed in the first step. This process consists of three sub-steps: entity mention identification and anchoring, question intent parsing and relationship anchoring, and consistency verification.
[0066] For the question and answer texts in the seed question-answer pair, the aforementioned medical named entity recognition model is used for entity annotation, resulting in lists of entity mentions in the question and answer texts, respectively. Then, entity anchoring is performed: the text span of each entity mention is linked to a standard node in the medical knowledge graph. The anchoring process employs a multi-stage matching strategy: first, the entity mention text is normalized (e.g., removing plural forms and standardizing spelling); second, a pre-built medical thesaurus is used to map the normalized mentions to a set of candidate standard concept identifiers; finally, the semantic type of the entity mention in the text (provided by the recognition model) is compared with the type of the candidate standard concepts, retaining only those with type matches. If multiple type-matching candidates exist for the same text span, disambiguation is further performed using graph distances between other anchored entities in the context—selecting the candidate standard concept with the shortest average path length to other entities in the context. Ultimately, all successfully anchored entities in the question text constitute the question-anchored entity set, and all successfully anchored entities in the answer text constitute the answer-anchored entity set.
[0067] After entity anchoring is completed, it is necessary to identify the query relationship type implied in the question text. This invention employs a lightweight intent classifier, which takes the word sequence of the question text and the positions of the anchored entities as input and outputs a predefined relationship type label. The internal structure of the intent classifier includes a dual encoder: one encoder performs semantic encoding on the entire question text, and the other encoder encodes the relative positions and types between entities in the question. The output vectors of the two encoders are fused and mapped to a relationship type space through a multilayer perceptron. All labels in this relationship type space directly correspond to the set of edge types defined in the first step of the knowledge graph (e.g., "manifests as", "treatment", "diagnosis"). The relationship type output by the classifier serves as the anchored relationship type.
[0068] To prevent logical contradictions between entity anchoring and relation anchoring, this step includes a rapid verification process. Verification rules include: the entity types in the question anchoring entity set must be compatible with the domain of the anchoring relation type (for example, if the anchoring relation type requires the subject entity to be of type "disease," then the question anchoring entity set should contain at least one disease entity); the entity types in the answer anchoring entity set must be compatible with the value domain of the anchoring relation type. If compatibility is not met, the seed question-answer pair is marked as a low-quality sample, excluded from subsequent enhancement processes, or sent for manual review.
[0069] After the above annotation process, each successful seed question-answer pair is transformed into a structured query triple, called a graph query pattern. The formal definition of this pattern is: a set of anchored entities for a question, an anchor relation type, and a set of anchored entities for the answer. It should be noted that both the question and answer anchor entity sets may contain multiple entities, reflecting the reality that questions in question-answering may involve multiple medical concepts (e.g., asking about multiple symptoms simultaneously). The anchor relation type in the graph query pattern describes the core semantic association from the question anchor entity set to the answer anchor entity set. In subsequent steps, this relation type will serve as the main constraint for generating deformable queries. The graph query pattern acts as a bridge between the seed question-answer pair and the knowledge graph, enabling natural language expressions to be accurately mapped to subgraph structures on the graph, providing the operational unit for the semantic equivalence deformation in the third step.
[0070] S3. Based on the graph query pattern, perform entity replacement deformation and / or relation path deformation on the medical knowledge graph to generate multiple derived query patterns.
[0071] Specifically, entity replacement transformation aims to replace entities in the question-anchored entity set and answer-anchored entity set of the original query pattern with semantically equivalent entities, while maintaining the anchoring relationship type unchanged. Its core idea is that in the hierarchical structure of medical knowledge graphs, entities of the same semantic type and at similar or equivalent levels are often interchangeable within the same medical relational context. This transformation process consists of three coherent stages: candidate entity space construction, replacement compatibility determination, and derived query pattern generation.
[0072] In the graph query pattern, each entity (including each member of the question-anchored entity set and the answer-anchored entity set) has its semantic type node determined in the medical knowledge graph. Since the knowledge graph constructed in the first step contains a separate structure of type layer and instance layer, each instance layer entity is connected to one or more type nodes in the type layer via "instantiation" edges. Using this hierarchical structure, the system automatically searches upwards for the entity's direct parent type, then traverses downwards along the type layer edges, collecting all sibling entities sharing the same direct parent type as the original entity, as well as descendant entities with the same semantic type. These entities collectively constitute the candidate replacement space for the original entity. The range of the candidate space can be controlled by a configurable semantic distance threshold, which limits the maximum number of hops in the type layer, thus avoiding semantic drift caused by excessive generalization.
[0073] Not all entities in the candidate space can arbitrarily replace the original entities. The system must ensure that a valid connection still exists between the replaced entity and the original anchoring relationship type. To this end, a compatibility test is performed on each pair of candidate replacement entities (selecting one candidate entity from the question anchoring entity set to replace the original question entity, and simultaneously selecting a corresponding candidate entity from the answer anchoring entity set to replace the original answer entity). The compatibility test is conducted on the knowledge graph: for each entity in the new question anchoring entity set after replacement, it is checked whether at least one entity in the answer anchoring entity set can be reached from that entity via the relationship edge defined by the anchoring relationship type. Simultaneously, the existence of a reverse path is verified, i.e., whether the answer entity can be connected to the question entity through a reverse relationship. A replacement is considered compatible only if a replacement combination makes the original anchoring relationship type still valid between the new entity pairs. For complex query patterns containing multiple question entities or multiple answer entities, the compatibility test needs to consider Cartesian product combinations, but only the existence of at least one feasible connection path is required to pass.
[0074] For each replacement combination that passes the compatibility check, the system generates a new derived query pattern. The structure of this derived query pattern is completely identical to the original graph query pattern, except that the entities at the corresponding positions are replaced with new candidate entities. It is worth noting that when the original question anchoring entity set or answer anchoring entity set contains multiple entities, the replacement can be applied independently to each member or as a whole, resulting in various combined transformations. The derived query pattern retains the anchoring relationship type in the original graph query pattern and records the replacement mapping path used in this transformation for subsequent traceability. All derived query patterns are collected into a temporary set as the output of this transformation.
[0075] Entity replacement transformation utilizes the hierarchical structure of knowledge graphs rather than simple word list replacement, ensuring that the replaced entity and the original entity are at the same medical semantic granularity level. At the same time, a compatibility judgment mechanism is introduced to ensure that the replaced entity pair still has a real medical association under the original relation type, avoiding the problem of "relationship breakage after replacement" in traditional enhancement methods.
[0076] The goal of relational path transformation is to replace the anchored relation types in the original graph query pattern with one or more semantically equivalent paths, while keeping the question-anchored entity set and the answer-anchored entity set unchanged. These paths connect subjects and objects of the same type in the knowledge graph, but are implemented through different intermediate nodes and relation sequences. This transformation can expand the semantic expression diversity of queries without changing the core intent of the query.
[0077] For a given anchoring relation type, the system performs a constrained path discovery process on the medical knowledge graph. This process starts with the standard semantic relation corresponding to the anchoring relation type, and uses a predefined set of equivalence rules in the graph and path patterns discovered through graph structure statistics to generate an equivalent path candidate pool.
[0078] The set of equivalence rules originates from equivalence mappings pre-entered by medical knowledge engineering experts. For example, certain single-hop relations are logically equivalent to two-hop or multi-hop composite relations (such as "disease-treatment drug" which may be equivalent to "disease-treatment guidelines-guidelines contain drugs"). These rules are stored as a mapping table from relation schemas to path schemas.
[0079] Furthermore, the system employs a graph-based statistical method to automatically discover potential equivalent paths: frequency statistics are performed on all paths connecting the same pair of semantic types (subject type and object type) in the medical knowledge graph, and path patterns with a frequency higher than a set threshold and a path length not exceeding a preset upper limit are selected. Each path pattern is represented as a sequence of relation types. To verify whether the path is truly equivalent to the original anchored relation type, the system performs a logical consistency check: for a randomly sampled subject entity, the overlap between the object set obtained through the original single-hop relation and the object set obtained through candidate path reasoning is compared. If the overlap exceeds a preset semantic threshold, the path pattern is considered statistically equivalent to the original relation type.
[0080] After obtaining the equivalent path pattern, it needs to be instantiated into a specific derived query pattern. For each equivalent path pattern, the system searches the knowledge graph for all specific intermediate nodes that make the path pattern valid, based on the question anchor entity set and answer anchor entity set in the original query pattern. Specifically, for a certain entity in the question anchor entity set and a certain entity in the answer anchor entity set, the system checks whether there exists an actual path starting from the question entity, passing through the relation sequence defined in the path pattern, and finally reaching the answer entity. If it exists, all intermediate entities and relations on the path are recorded. Since an equivalent path pattern may correspond to multiple different instance paths (with different intermediate nodes), the system generates multiple derived query patterns, each using one of the specific instance paths. In the derived query pattern, the original anchor relation type is replaced with the relation sequence on the instance path, while the question anchor entity set and answer anchor entity set remain unchanged, but intermediate nodes on the path are added as implicit constraints (these intermediate nodes do not appear directly in the final generated question, but are used to ensure the validity of the path).
[0081] For more complex scenarios, relational path transformations can be applied recursively: a segment of a path sequence in a derived query pattern can be further replaced by another equivalent path pattern, forming multi-level nested transformations. The system has a maximum nesting depth limit to prevent query patterns from becoming too complex and losing readability. Additionally, each derived query pattern is accompanied by a transformation complexity score, which is weighted by path length and nesting depth, and used to control the diversity of generated question-answer pairs in subsequent steps.
[0082] Relational path transformation can not only discover implicit composite paths in medical knowledge graphs that are semantically equivalent to explicit relations, but also ensure the reliability of equivalence through statistical consistency checks. In addition, intermediate nodes are retained as implicit constraints during path instantiation, so that the transformed query pattern can still be accurately anchored to the real structure in the graph, rather than a semantic connection made up out of thin air.
[0083] Entity substitution and relational path transformation can be performed independently or in combination sequentially—that is, first perform entity substitution on a derived query pattern, then perform relational path transformation on the result, and vice versa. Finally, the third step outputs a set of multiple derived query patterns, where each pattern is semantically equivalent to the original seed question-answer pair but has different entity combinations or relational expression paths. These derived query patterns will serve as direct input for the fourth step of natural language generation.
[0084] S4. Convert each derived query pattern into natural language question text and answer text using a natural language generator to form an enhanced question-answer pair.
[0085] Specifically, the natural language generator is a processing pipeline consisting of four cooperating components: a syntactic template library, an entity name normalization module, a path sequence-to-sentence decoder, and an answer synthesizer. This generator can handle two types of derived query patterns: one containing only single-hop relations or simple entity substitutions, and the other containing multi-hop relation paths or complex entity sets.
[0086] The syntactic template library is a predefined collection of templates indexed by relation type and path pattern. Each template is a sentence framework with placeholders for subsequent entity name input. Templates are organized according to common interaction patterns in medical Q&A, such as asking about symptoms, medications, tests, causes, and prognoses. For single-hop relation types, each type corresponds to a set of templates with different sentence styles (e.g., declarative, interrogative, imperative). For multi-hop paths, the template library maintains a template combination rule: each relation in a path sequence corresponds to a sub-template, and sub-templates are concatenated using logical connectors (e.g., "and", "or", "therefore"). The template library supports dynamic expansion; when the system encounters a path pattern not yet included, it automatically calls a template generator to generate a new template based on the semantic tags of the relation types in the path and common word order, and stores it in the template library for later reuse.
[0087] The entity nodes in the medical knowledge graph store standardized concept names (usually strict medical terms, such as "acute ST-segment elevation myocardial infarction"). However, in natural language questions, these standardized names often need to be converted into expressions that better conform to clinical communication habits. The entity name normalization module is responsible for performing this conversion. Internally, this module maintains a multi-level mapping dictionary: the first level maps standard concept identifiers to their preferred clinical terms (from the "preferred name" field of the medical ontology); the second level provides common synonyms or abbreviations; the third level stores context-sensitive variation rules, such as using the full name when it is the subject in the question and the abbreviation when it is the object. The module also integrates a voice adapter that dynamically selects the appropriate form based on the entity's grammatical role in the question (subject, object, modifier). For rare entities that cannot be automatically mapped, the module retains the standardized name and marks it for manual review after output.
[0088] The decoder for path sequences to sentences takes as input a derived query pattern, which may contain a relation type, a relation path sequence, and sets of question-anchored entities and answer-anchored entities. The decoder's workflow is as follows:
[0089] First, identify the type of the derived query pattern. If the pattern contains only a single-hop relation type, select a template that matches that relation type directly from the syntactic template library (the template selection strategy can be random selection or rotation based on historical usage frequency). If the pattern contains a sequence of relation paths, invoke the template combination rule: map each relation in the path to its corresponding sub-template, and then concatenate these sub-templates with logical connectors according to the path order to form a composite problem framework.
[0090] Secondly, entities from the problem-anchored entity set are filled into the corresponding placeholders in the template according to their logical priority. When multiple entities appear simultaneously, the decoder automatically inserts appropriate coordinating conjunctions (such as "and", "as well as", "or") and quantifiers (such as "which", "whether"). During the placeholder filling process, the entity name normalization module is called to perform a mouth-appropriate transformation on each entity name.
[0091] Finally, the decoder performs fluency fine-tuning on the generated original sentences. Fine-tuning includes: removing duplicate spaces or redundant punctuation caused by placeholder replacements, adjusting subject-verb agreement (e.g., unifying the verb form when medical terms are plural), and converting passive voice to active voice as needed. The fine-tuning rules are based on a set of linguistic constraints and do not rely on external language models to ensure the determinism of the output.
[0092] The answer synthesizer is responsible for generating the answer text based on the derived query pattern. Unlike questions, which require diverse sentence structures, the answer portion must be concise, accurate, and direct. The answer synthesizer first determines the cardinality of the answer anchor entity set: if the set contains only one entity, the answer is the normalized name of that entity; if the set contains multiple entities, the answer arranges these entities according to their common order in the knowledge graph (e.g., alphabetical order, clinical importance order), separated by commas or semicolons, and finally adds a period at the end. For derived query patterns generated by relation path transformations, the answer can also selectively include intermediate node information, but by default, only the final answer anchor entity set is output. The answer synthesizer also supports an answer expansion mode: when the answer anchor entity set in the original derived query pattern is empty (i.e., the question is a yes / no question), the answer synthesizer outputs "yes" or "no," based on whether any entity can be reached from the question anchor entity along the anchor relationship in the knowledge graph.
[0093] For each derived query pattern output in step three, execute the following generation process to produce a natural language question-answer pair.
[0094] Step 1: Problem generation.
[0095] First, the derived query pattern is fed into the path sequence to sentence decoder. The decoder determines the generation strategy based on the variant type identifier (entity substitution variant or relation path variant) carried in the pattern and the relation expression form within the pattern. If the pattern is generated by entity substitution variant, the relation expression form is the same as the original seed, and the decoder directly uses the template corresponding to the original relation type. If the pattern is generated by relation path variant, the decoder must process multiple relations in the path sequence. For multiple relations, the decoder does not simply concatenate the sub-templates, but adopts a "headword anchoring" strategy: it identifies the relation with the most semantic core (usually the relation that directly describes the question's intent) from the path sequence and uses it as the main template, embedding other relation segments as modifying clauses or prepositional phrases within the main template. This approach generates sentences that are more natural than linear concatenation.
[0096] After template selection and filling are completed, the decoder outputs a draft of the question text. Subsequently, the entity name normalization module scans and transforms all entity names in the draft, replacing standardized concepts with clinically common expressions. Finally, the fluency fine-tuning module performs a grammar cleansing, outputting the final question text.
[0097] Step 2: Answer generation.
[0098] Input the same derived query pattern into the answer synthesizer. The answer synthesizer extracts the set of answer anchor entities from the pattern. If the set is not empty, it sequentially calls the entity name normalization module for each entity in the set (entity names in the answer usually use preferred clinical terms and do not require further abbreviation). The normalized entity names are assembled into an answer string in sequence, formatted as a comma-separated list ending with a period. If the set of answer anchor entities is empty but the pattern implicitly contains yes / no information (e.g., indicating existence through a segment of a relation path transformation), it outputs "yes" or "no". For particularly complex derived query patterns (e.g., the set of answer anchor entities contains more than a preset threshold), the answer synthesizer can trigger a compression mode, outputting only the first few entities followed by "etc." and indicating the total number at the end.
[0099] Step 3: Question-answer pair assembly and metadata recording.
[0100] The generated question text and answer text are assembled into a complete question-and-answer pair. Simultaneously, metadata tags are attached to this question-and-answer pair, including: the identifier of the source seed question-and-answer pair, the type of transformation used (entity substitution or relational path transformation), the identifier of the substituted entity pairs or equivalent path patterns used during the transformation process, and the generation timestamp. This metadata is used for subsequent quality analysis and manual verification.
[0101] Step 4: Output aggregation.
[0102] After performing the above steps sequentially on all derived query patterns, an enhanced question-answer pair set is obtained. The size of this set is equal to the number of derived query patterns output in step three (because each pattern generates one question-answer pair). The order of the question-answer pairs in the set is consistent with the generation order of the derived query patterns, but the confidence filtering in step five may remove some of them.
[0103] S5. Use predefined attribute range constraints, relation mutual exclusion constraints, and path legality constraints in the medical knowledge graph to validate the augmented question-answer pairs, and include the question-answer pairs that pass all constraints into the augmented training dataset.
[0104] Specifically, during the initial construction of the medical knowledge graph, a consistency rule base was simultaneously established, bound to the graph's entities and relationships. This rule base contains three types of rules: attribute range constraints, relationship mutual exclusion constraints, and path validity constraints. Each type of rule is encoded based on authoritative knowledge in the medical field (such as contraindications in clinical guidelines, dosage limits in drug instructions, and inherent exclusionary relationships in anatomy and pathology) and stored in a machine-readable form in the knowledge graph's metadata layer. Rules can be attached to specific entities (e.g., the dosage range of a drug), specific relationship types (e.g., the mutual exclusion between "treatment" and "contraindication"), or specific path patterns (e.g., requiring a connected path from the question entity to the answer entity).
[0105] Attribute range constraints are used to verify whether the numerical or enumerated attribute values appearing in question-answer pairs are within a reasonable range allowed by medical standards. This type of constraint mainly applies to the following scenarios: when the generated questions or answers mention quantifiable information such as drug dosage, normal range of test values, time windows (such as incubation period), and age restrictions, the system needs to verify whether the value is consistent with the attribute range of the corresponding entity stored in the knowledge graph.
[0106] The verification process is as follows: The system first scans the question and answer texts in the question-answer pair. Using the entity and attribute binding information recorded during the fourth step of generation (each enhanced question-answer pair retains the entity identifier and path information from its derived query pattern during generation, thus allowing direct tracing to specific nodes in the knowledge graph), it extracts all entity mentions with attribute constraints. For each such entity, the system reads its predefined attribute range boundaries from the knowledge graph, including minimum value, maximum value, set of valid enumerated values, and unit requirements. Then, it compares the actual attribute values appearing in the question-answer pair with these boundaries. If the attribute value falls within a valid range or belongs to a valid enumerated set, and the unit matches, the constraint passes; otherwise, the question-answer pair is determined to not satisfy the attribute range constraint and is immediately marked as invalid.
[0107] It is important to note that the validation of attribute range constraints does not rely on the precise format of the numerical values. Instead, it compares the numerical values in the question-and-answer pair with the standard attributes of their associated entities after normalization. For complex question-and-answer pairs containing multiple attribute values, the system validates each attribute one by one, and only determines that the constraint passes if all attributes pass.
[0108] Mutually exclusive constraints are used to detect whether logically mutually exclusive semantic relationships exist in question-and-answer pairs. Mutually exclusive relationships are widespread in medical knowledge; for example, "indications" and "contraindications" cannot simultaneously refer to the same drug and the same disease, "etiology" and "irrelevant factors" cannot coexist, and "preferred treatment" and "contraindicated treatment" cannot co-occur for the same condition. Mutually exclusive constraints are stored in a rule base as relation pairs. Each mutually exclusive rule defines that two relation types or relation instances cannot simultaneously appear within the same question-and-answer semantic framework.
[0109] The verification process is as follows: The system extracts all relevant relation types from the derived query pattern corresponding to the question-and-answer pair to be verified. This includes the original anchor relation type, sub-relation types introduced in relation path transformations, and sibling relationships implicitly carried in entity replacement transformations. The system groups these relation types into a relation set and then iterates through each mutual exclusion rule in the rule base: if two relation types specified by a mutual exclusion rule appear simultaneously in the relation set, a conflict is triggered. Furthermore, mutual exclusion constraints apply not only to relation types but also to relation instances at the entity level. For example, for the specific relation instances "Drug A - Treatment - Disease B" and "Drug A - Contraindication - Disease B," even if their relation types are not mutually exclusive, they are mutually exclusive for the same drug and disease entities. Therefore, the system also needs to check whether there are cases in the derived query pattern where the same pair of entities generates conflicting semantics through different relations. If any mutual exclusion conflict is found, the question-and-answer pair is determined to not satisfy the relation mutual exclusion constraint and is rejected.
[0110] Path validity constraints are used to ensure that the semantic connection path from the question-anchored entity set to the answer-anchored entity set in the derived query pattern is real and logically consistent with the medical knowledge graph. This constraint is the most fundamental of the three types of constraints, directly verifying whether the knowledge structure upon which the question-answer pair depends is consistent with the topology of the knowledge graph.
[0111] The verification process consists of two sub-steps:
[0112] (1) Connectivity Verification: The system retrieves the question anchor entity set and the answer anchor entity set from the derived query pattern, as well as the relational paths defined in the pattern (for entity replacement transformations, the path is the single-hop edge corresponding to the original anchor relation type; for relational path transformations, the path is the selected equivalent path sequence). For each entity in the question anchor entity set, the system attempts to traverse the graph in the knowledge graph starting from that entity and following the relational path direction specified in the pattern to check if it can reach at least one entity in the answer anchor entity set. If there is at least one path to the answer anchor entity set for all entities in the question anchor entity set (allowing different question entities to reach different answer entities), the connectivity verification passes. Conversely, if any question entity cannot be connected to any answer entity through the given path, the path is deemed invalid.
[0113] (2) Semantic Consistency Verification: Connectivity verification only guarantees reachability on the graph structure. However, in a medical knowledge graph, there may be multiple paths with different semantics connecting the same pair of entities, some of which may not be reasonable in clinical practice. Semantic consistency verification further requires that the specific relation sequence used in the derived query pattern must be completely consistent with the authoritative relation labeled for the corresponding entity pair in the knowledge graph, or must be one of the predefined equivalent path patterns. The system maintains a "legal path whitelist," which consists of the original relation edges directly extracted from the authoritative source during the first step of knowledge graph construction, and the equivalent path patterns that have passed the statistical consistency test and been manually confirmed during the third step of relation path transformation. Any path not in the whitelist, even if it is connected on the graph structure, is considered an illegal path. For the original single-hop relation generated in the entity replacement transformation, as long as the relation edge actually exists between the replaced entity pairs in the knowledge graph, it is automatically added to the whitelist.
[0114] When a derived query pattern contains multiple question entities or multiple answer entities, the path validity constraint requires the existence of a matching scheme such that the sub-paths from each question entity to at least one answer entity are all valid. The system employs a graph matching-based verification algorithm to ensure that the overall path combination does not contain any locally invalid segments.
[0115] For each enhanced question-answering pair, the system sequentially performs attribute range constraint checks, relation mutual exclusion constraint checks, and path validity constraint checks. The checks are performed in ascending order of computational cost: first, attribute range constraints are checked (typically requiring only constant time for comparison); then, relation mutual exclusion constraints are checked (requiring querying relation pairs in the rule base); and finally, path validity constraints are checked (involving graph traversal and matching, resulting in the highest cost). If any constraint fails, subsequent constraints are not executed to conserve computational resources.
[0116] An augmented question-answering pair is labeled "passed" only if all three types of constraints are met, and its metadata is written into the final augmented training dataset. For question-answering pairs that fail any constraint, the system first checks the reason for the failure: if the failure is caused by attribute range constraints or relation mutual exclusion constraints, it usually indicates that the question-answering pair contains a clear medical error and is discarded directly; if the failure is caused by path validity constraints, there may be two situations—one is that the derived query pattern is indeed illegal, and the other is that the knowledge graph itself has knowledge gaps or incompleteness. To distinguish between these two situations, the system sends question-answering pairs that fail the path validity constraints to a special "review queue," which can be periodically sampled and reviewed by medical experts. The review results can be used to reverse-correct missing relations in the knowledge graph or adjust the equivalent path whitelist.
[0117] The second embodiment of this application is as follows:
[0118] Please see Figure 3 This invention provides a precise question-answering data augmentation system based on knowledge graph annotation, applied to a precise question-answering data augmentation method based on knowledge graph annotation as provided in the first embodiment, comprising:
[0119] The medical knowledge graph construction module 101 is used to extract medical entities, entity attributes and relationships between entities from legally authorized multi-source medical knowledge bases, and construct a hierarchical semantic graph structure containing type layer and instance layer based on the extracted three elements.
[0120] The graph annotation module 102 is used to identify and anchor medical entities from the question and answer texts of seed question-answer pairs using a medical named entity recognition model, parse the question intent to anchor the relationship type, and generate a structured graph query pattern.
[0121] The semantic equivalence transformation module 103 is used to perform entity replacement transformation and / or relation path transformation on the medical knowledge graph based on the graph query mode to generate multiple derived query modes.
[0122] Natural language generation module 104 is used to convert each derived query pattern into natural language question text and answer text through a natural language generator to form an enhanced question-answer pair.
[0123] The confidence filtering module 105 is used to validate the augmented question-answer pairs using predefined attribute range constraints, relation mutual exclusion constraints, and path legality constraints in the medical knowledge graph, and to include the question-answer pairs that pass all constraints into the augmented training dataset.
[0124] Regarding the system in the above embodiments, the specific ways in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated here.
[0125] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this application according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0126] Accordingly, this application also provides an electronic device, including: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the aforementioned knowledge graph-based accurate question-answering data augmentation method. Figure 4 The diagram shown is a hardware structure diagram of any device with data processing capabilities, where a precise question-answering data augmentation system based on knowledge graph annotation, provided in an embodiment of the present invention, is located. (Except for...) Figure 4 In addition to the processor, memory, and network interface shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.
[0127] Accordingly, this application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the aforementioned method for precise question-answering data augmentation based on knowledge graph annotation. The computer-readable storage medium can be an internal storage unit of any data-processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data-processing device, and can also be used to temporarily store data that has been output or will be output.
[0128] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0129] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.
Claims
1. A precise question-answering data augmentation method based on knowledge graph annotation, characterized in that, Includes the following steps: Medical entities, entity attributes, and relationships between entities are extracted from legally authorized multi-source medical knowledge bases. Based on the extracted three elements, a hierarchical semantic graph structure containing a type layer and an instance layer is constructed for medical knowledge graphs. A medical named entity recognition model is used to identify and anchor medical entities from the question and answer texts of seed question-answer pairs, and the question intent is parsed to anchor the relationship type, generating a structured graph query pattern. The graph query pattern includes a question anchor entity set, an anchor relationship type, and an answer anchor entity set. Based on the graph query pattern, entity replacement deformation and / or relation path deformation are performed on the medical knowledge graph to generate multiple derived query patterns. In the entity replacement deformation, the anchor relation type is kept unchanged while the entity is replaced. In the relation path deformation, the entity is kept unchanged while the semantically equivalent path sequence is replaced. Each derived query pattern is converted into natural language question and answer text by a natural language generator to form an enhanced question-answer pair. We use predefined attribute range constraints, relation mutual exclusion constraints, and path validity constraints in the medical knowledge graph to validate the augmented question-answer pairs, and include the question-answer pairs that pass all constraints into the augmented training dataset.
2. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, The construction of a medical knowledge graph specifically includes: obtaining raw data from publicly available or authorized medical guidelines, textbooks, and anonymized databases; using a deep learning-based hybrid extraction pipeline to extract medical entities, entity attributes, and relationships between entities; and resolving conflicting triples using a voting mechanism based on the strength of evidence. The construction process employs a hierarchical semantic graph structure, separating the type layer from the instance layer. The type layer stores the superclass-subclass relationships of medical concepts, while the instance layer stores specific entities and their attributes and relationships. Instantiated edges connect the two layers.
3. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, The medical named entity recognition model includes: a character-level feature encoding layer, a contextual semantic fusion layer, and a type constraint output layer; wherein the type constraint output layer introduces a medical type constraint matrix, which is derived from the type layer of the medical knowledge graph and defines the compatibility and mutual exclusion between different semantic types. The conditional random field decoder is combined with the constraint matrix to search for the globally optimal entity type label sequence.
4. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, Anchoring medical entities employs a multi-stage matching strategy, utilizing a thesaurus and graph distances between other anchored entities in the context for disambiguation; parsing the question intent maps the question text to predefined relation types in the knowledge graph as anchor relation types.
5. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, Entity replacement transformation includes: utilizing the type layer of the medical knowledge graph to construct a candidate entity space for each entity in the original graph query pattern, which contains sibling entities sharing the same direct parent type and descendant entities with the same semantic type; performing a replacement compatibility judgment on each candidate replacement combination to check whether the new question anchor entity set and the new answer anchor entity set after replacement can still be connected in the knowledge graph through the anchor relationship type; and generating a new derived query pattern from the replacement combinations that pass the judgment.
6. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, Relational path transformations include: equivalent path mining and path instantiation; Equivalent path mining is based on a predefined set of equivalence rules and graph structure statistical methods to obtain semantically equivalent path patterns from question entity types to answer entity types, and performs logical consistency checks on candidate path patterns. When a path is instantiated, while keeping the question anchor entity set and the answer anchor entity set unchanged, the original anchor relationship type is replaced with a specific instance path, and the intermediate nodes on this path are retained as implicit constraints in the derived query pattern.
7. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, The natural language generator includes a syntactic template library, an entity name normalization module, a path sequence to sentence decoder, and an answer synthesizer; the path sequence to sentence decoder adopts a headword anchoring strategy, identifies core relations from the relation path sequence as the main template, and embeds other relations as modifiers to generate question text; The entity name normalization module converts standardized concept names in the knowledge graph into clinically common expressions; the answer synthesizer dynamically outputs the format based on the cardinality of the entity set anchored by the answer, and outputs yes or no for empty sets and yes / no questions.
8. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, Attribute range constraint validation is used to verify whether the numerical or enumerated attribute values mentioned in the question-answer pair are within the valid range of the corresponding entity in the knowledge graph; Mutual exclusion constraint validation is used to detect whether a question-answer pair contains logically mutually exclusive relation types or combinations of relation instances. The path validity constraint verification includes connectivity verification and semantic consistency verification. It requires that the path in the derived query pattern must belong to the predefined legal path whitelist, and that each entity in the question anchor entity set can reach at least one entity in the answer anchor entity set along the path.
9. The precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, The method further includes: for enhanced question-answer pairs that fail the path validity constraint, sending them to a review queue for manual review and reverse correction of the knowledge graph or the legal path whitelist; and directly discarding enhanced question-answer pairs that fail the attribute range constraint or the relationship mutual exclusion constraint.
10. A precise question-answering data augmentation system based on knowledge graph annotation, applied to the precise question-answering data augmentation method based on knowledge graph annotation as described in claim 1, characterized in that, include: The medical knowledge graph construction module is used to extract medical entities, entity attributes, and relationships between entities from legally authorized multi-source medical knowledge bases, and to construct a hierarchical semantic graph structure containing type layers and instance layers based on the extracted three elements. The graph annotation module is used to identify and anchor medical entities from the question and answer texts of seed question-answer pairs using a medical named entity recognition model, parse the question intent to anchor the relationship type, and generate a structured graph query pattern. The semantic equivalence transformation module is used to perform entity replacement transformation and / or relation path transformation on the medical knowledge graph based on the graph query pattern, and generate multiple derived query patterns. The natural language generation module is used to convert each derived query pattern into natural language question text and answer text through a natural language generator, forming an enhanced question-answer pair. The confidence filtering module is used to validate augmented question-answer pairs using predefined attribute range constraints, relation mutual exclusion constraints, and path validity constraints in the medical knowledge graph, and to include question-answer pairs that pass all constraints into the augmented training dataset.