Accurate question and answer method based on knowledge graph and large language model
By integrating knowledge graphs and an improved DeBERTa model into a question-answering system, utilizing TransE and CompGCN for graph neural reasoning, and combining ConceptNet external knowledge and syntactic-aware positional encoding, the problem of insufficient semantic understanding and reasoning ability of question-answering systems in the two-carbon domain is solved, achieving efficient and accurate answer generation.
Patent Information
- Application Number
- CN202511692403.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-02-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing question-answering systems based on large language models suffer from problems such as shallow semantic understanding, limited reasoning ability, entity recognition ambiguity resolution, and inaccurate knowledge retrieval when dealing with complex and structured questions, making it difficult to provide efficient answer support in the dual-carbon domain.
By integrating knowledge graphs and an improved DeBERTa model, global embedding vectors are obtained through TransE model training, graph neural reasoning is performed using CompGCN, and bidirectional cross-modal fusion is executed by combining ConceptNet external knowledge and syntactic-aware positional encoding to achieve entity recognition, knowledge retrieval, and answer generation.
It enhances the semantic understanding and reasoning capabilities of the question-and-answer system in the field of carbon, improves the accuracy and professionalism of the answers, and is suitable for high-requirement scenarios such as corporate carbon inventory, ESG report answering, and carbon neutrality policy inquiry.
Smart Images

Figure CN121503684A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing, and in particular to a precise question-answering method based on knowledge graphs and large language models. Background Technology
[0002] Against the backdrop of rapid development in artificial intelligence, question-answering systems based on large language models have been widely applied in various intelligent service platforms. Traditional question-answering systems mostly rely on retrieval or generative strategies. The former extracts answers from documents through keyword matching, while the latter relies on neural network models to generate answers. However, these methods often suffer from problems such as shallow semantic understanding and limited reasoning ability, making it difficult to accurately answer complex and structured questions. To improve the understanding and reasoning capabilities of question-answering systems, researchers have introduced knowledge graphs as an aid, enhancing the system's ability to model real-world knowledge by explicitly modeling entities and relationships.
[0003] In recent years, pre-trained language models (such as BERT, DeBERTa, and GPT) have made significant progress in natural language understanding tasks, especially in context modeling and semantic representation. However, these models still have limitations when handling tasks such as entity alignment and structural reasoning, mainly due to the lack of guidance from external knowledge structures. Furthermore, while traditional knowledge graph embedding methods such as TransE can generate vector representations for entities and relations, they cannot fully exploit higher-order relations and contextual information within the graph structure, resulting in insufficient representational capabilities.
[0004] Existing methods for integrating language models and knowledge graphs mostly remain at the shallow interaction level, lacking deep alignment mechanisms for entity semantics and linguistic context. Furthermore, for complex two-carbon domain natural language problems, existing systems still suffer from low accuracy, insufficient contextual understanding, and limited fusion methods in areas such as entity recognition and ambiguity resolution, knowledge retrieval, entity relationship modeling, and cross-modal fusion strategies, thus restricting the effectiveness of question-answering systems in real-world scenarios.
[0005] Therefore, how to provide an accurate question-answering method based on knowledge graphs and large language models is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0006] One objective of this invention is to propose a precise question-answering method based on knowledge graphs and large language models. This invention integrates several key technologies of structured knowledge modeling and semantic understanding enhancement, and constructs a question-answering framework supported by knowledge graphs and centered on an improved language model. It describes in detail the core steps such as entity recognition, knowledge retrieval, graph neural network reasoning, language semantic modeling, and cross-modal interaction fusion, and has the advantages of refined semantic understanding, strong reasoning ability, and high answer accuracy.
[0007] Step 1: Obtain the user-input natural language question in the dual-carbon domain, perform dual-carbon scenario preprocessing on the dual-carbon domain natural language question, and generate a dual-carbon candidate entity set; based on the dual-carbon candidate entity set, perform subgraph retrieval in a pre-set dual-carbon knowledge graph to obtain question-related dual-carbon subgraphs;
[0008] Step 2: Train the TransE model on the pre-set dual-carbon knowledge graph to obtain a global embedding vector set; based on the question-related dual-carbon subgraph, extract the corresponding entity embedding vector and relation embedding vector from the global embedding vector set;
[0009] Step 3: Use CompGCN to perform message passing and relation combination calculations on the problem-related bicarbon subgraph to generate node representations containing contextual structure information;
[0010] Step 4: Construct an improved DeBERTa semantically enhanced embedding, gating and fusing the lexical units of the question text with the corresponding concept vectors in the external knowledge base ConceptNet, and outputting the content embedding representation of the question text;
[0011] Step 5: In the improved DeBERTa, syntactic-aware positional encoding is used to perform dependency parsing to obtain the dependency relationships and dependency distances between lexical units. Positional encoding is generated based on the dependency information and used to decouple self-attention computation, outputting the contextual representation of the question.
[0012] Step 6: Execute a bidirectional cross-modal fusion mechanism to align the node representation with the context representation in vector space, perform gating fusion and bidirectional attention interaction to generate a fused representation; score and rank the candidate entities based on the fused representation, determine the target answer entity and output the corresponding answer text.
[0013] According to an embodiment of the present invention, a precise question answering method based on knowledge graphs and large language models includes the following steps:
[0014] Optionally, step one specifically includes:
[0015] Perform text normalization processing on natural language questions in the two-carbon domain input by users, and complete the unification of two-carbon terminology, cleaning up invalid characters and standardizing the format;
[0016] The normalized text is segmented to obtain a two-carbon word sequence for natural language problems in the two-carbon domain; two-carbon domain term tagging and named entity recognition are performed on the two-carbon word sequence to extract the position index of the two-carbon entity and the two-carbon word sequence in the sequence.
[0017] Based on the identified dual-carbon entities, a corresponding set of candidate entities is generated from the pre-set dual-carbon knowledge graph entity namespace;
[0018] Entity disambiguation is performed on the candidate entity set. The candidate entities are scored and sorted based on the context window, lexical position, dependency relationship, connection structure and frequency of occurrence of the candidate entity in the pre-set two-carbon knowledge graph, and filtered and deduplicated according to the set threshold to retain the final entity.
[0019] The final entity is standardized as a unique identifier in a pre-built dual-carbon knowledge graph, and a mapping relationship is established between question words and the final entity.
[0020] Starting with the final entity set, perform subgraph retrieval in the pre-set dual-carbon knowledge graph, and obtain a subgraph containing the target entity, relationship and adjacency structure according to the set retrieval radius, relation type filtering and node and edge number limit;
[0021] The results retrieved from the subgraph are merged and structured to form a question-related double-carbon subgraph, and the double-carbon word sequence of the question, the final entity set, and the mapping relationship from word to entity are output.
[0022] Optionally, step two specifically includes:
[0023] The TransE model is trained on the pre-set dual-carbon knowledge graph to obtain the global entity embedding vector corresponding to each entity and the global relation embedding vector corresponding to each relation, and an index table is established from the unique identifier of the pre-set dual-carbon knowledge graph to the embedding vector.
[0024] The global embedding vector set includes global entity embedding vectors and global relation embedding vectors;
[0025] Based on the corresponding identifiers of nodes and edges in the problem-related dual-carbon subgraph in the pre-set dual-carbon knowledge graph, the corresponding global entity embedding vectors and global relation embedding vectors are extracted from the index table to initialize the nodes and edges of the problem-related dual-carbon subgraph.
[0026] The initialization process includes: extracting the corresponding global entity embedding vector and global relation embedding vector from the index table based on the unique identifiers of nodes and edges in the problem-related dual-carbon subgraph in the preset dual-carbon knowledge graph, and assigning them to the nodes and edges in the problem-related dual-carbon subgraph respectively to form a problem-related dual-carbon subgraph with initial features;
[0027] For nodes and edges that do not exist in the index table, feature completion is performed using predefined placeholder embedding vectors, and the problem-related bicarbon subgraph with completed feature completion is output.
[0028] Optionally, the use of CompGCN to perform message passing and relation combination calculations on the problem-related bicarbon subgraph specifically includes:
[0029] Based on the problem-related bicarbon subgraph with initial features, perform graph structure construction operations to generate an enhanced adjacency structure;
[0030] The node feature matrix is composed of global entity embedding vectors, which are extracted and arranged according to the unique identifiers of nodes in the problem-related double-carbon subgraph.
[0031] The enhanced adjacency structure, node feature matrix, and global relation embedding vector are used as inputs to CompGCN, and the number of layers, hidden dimensions, and relation combination operations of CompGCN are set.
[0032] Based on the set of incoming edges and relation types recorded in the enhanced adjacency structure, message passing and relation composition calculations are performed to obtain a node representation containing context structure information;
[0033] Based on the set of candidate entities in the two-carbon graph, the node representations are indexed, aligned, and stored. A one-to-one correspondence table between the candidate entities and the nodes in the problem-related two-carbon subgraph is established. The correspondence table is registered as the node index, and the node representations are output.
[0034] Optionally, the construction of the semantically enhanced embedding of the improved DeBERTa specifically includes:
[0035] Based on the question's two-carbon word sequence and the two-carbon candidate entity set, determine the target word set for semantic enhancement;
[0036] Content embedding encoding of target lexical units is performed based on the improved DeBERTa vocabulary to obtain lexical content embeddings;
[0037] In the pre-built dual-carbon knowledge graph, a subset of ConceptNet containing dual-carbon related domain nodes is called. According to the mapping relationship between lexical text, lexical and candidate entity, the corresponding concept identifiers are retrieved from the ConceptNet subset and the concept vectors are extracted.
[0038] The concept identifier is a unique identifier for a node in the ConceptNet subset;
[0039] For lexical units for which no concept identifier can be retrieved, a predefined placeholder concept vector is set, and dimensional alignment is performed on the predefined placeholder concept vector to match the vector dimension of the lexical content embedding.
[0040] The predefined placeholder concept vectors are initialized by the dimensional mean of the concept vector set of the ConceptNet subset and participate in optimization as learnable parameters during the training of the improved DeBERTa model;
[0041] A gated fusion unit is constructed to receive word content embeddings and predefined placeholder concept vectors at the word unit granularity. The gate coefficients are calculated and the word content embeddings and predefined placeholder concept vectors are fused element by element to obtain semantically enhanced content embeddings.
[0042] Normalization and masking are performed on the semantically enhanced content embeddings to form the improved DeBERTa semantically enhanced embeddings;
[0043] The semantically enhanced embedding is output as the content embedding representation of the question.
[0044] Optionally, the use of syntactic-aware positional encoding in the improved DeBERTa specifically includes:
[0045] The improved DeBERTa performs word segmentation on the question text using a word segmenter, resulting in a sub-word level word sequence;
[0046] Perform dependency parsing on the problem text to obtain the headword index, dependency relation label, and shortest path length based on the dependency tree for each word.
[0047] Align sub-word level words with dependency tree nodes, generate mappings from sub-word level words to dependency tree nodes according to a preset sub-word merging strategy, and register placeholder indexes for words that cannot be aligned.
[0048] A syntax-aware position index is constructed at the granularity of arbitrary word pairs. The syntax-aware position index is represented by a combination of relative syntactic distance, dependency direction information and dependency relation labels. Placeholder indexes are assigned to items that exceed the threshold or are missing.
[0049] Based on the syntactic-aware position index, retrieve the syntactic-aware position embedding vector and complete the dimensional alignment and sequence alignment between the syntactic-aware position embedding vector and the semantically enhanced content embedding;
[0050] Within the decoupled self-attention layer of the improved DeBERTa, attention weights are calculated for content-to-content, content-to-location, and location-to-content, respectively.
[0051] The attention weights are modeled using syntactic-aware position embedding to obtain a comprehensive attention score, and masks are applied to invalid and filled positions.
[0052] Guided by the comprehensive attention score, the semantically enhanced content embeddings of all sub-word-level lexical sequences are weighted and aggregated to generate the contextual intermediate representation of the current layer;
[0053] The intermediate context representation is sequentially fed into the feedforward network, normalized and residual connections, and the consistency of lexical and position indexes is maintained between layers;
[0054] The process involves sequentially performing comprehensive attention score calculation, feedforward network, normalization, and residual connection on the sub-word-level word sequence according to the set number of layers, and outputting a context representation containing syntactic dependency information.
[0055] Optionally, the step of modeling the positional terms of the attention weights according to the syntactic-aware positional embedding specifically includes:
[0056] For any query term and key term, calculate the attention score for the query term and key term;
[0057] The attention score consists of two parts. The first part is the dot product of the query vector and the key vector, which yields the semantic similarity term.
[0058] The second part is the position term, which is obtained by mapping the corresponding syntactic-aware position embedding vector through a linear transformation function.
[0059] The semantic similarity term and the position term are added together to obtain the comprehensive attention score.
[0060] Optionally, the bidirectional cross-modal fusion mechanism specifically includes:
[0061] Perform vector space alignment processing on the node representation and the context representation respectively. The vector space alignment includes dimensional projection, normalization and scale unification of the node representation and the context representation, and map the aligned node representation and the context representation to the same latent representation space.
[0062] The node-to-word pairing relationship is generated based on the candidate entity-to-node index and the word-to-position index, and a mask mark is registered for invalid pairings;
[0063] Perform bidirectional attention interaction, calculate the interaction weights in both directions (node to word and word to node), and set invalid pairs to an unparticipation state.
[0064] A gated fusion unit is constructed based on the bidirectional attention interaction results. The aligned node representation and context representation are received according to the pairing relationship. The gate coefficient is calculated and the aligned node representation and context representation are fused element by element to generate lexical-enhanced node representation and node-enhanced context representation.
[0065] The node representations enhanced by lexical elements are weighted and aggregated along the lexical dimension to obtain the candidate entity-level fusion representation, and the context representations enhanced by nodes are weighted and aggregated along the node dimension to obtain the sequence-level fusion representation.
[0066] The fusion representation is a candidate entity-level fusion representation and a sequence-level fusion representation;
[0067] The fused representation is used for matching and scoring. The matching and scoring is performed sequentially through a learnable multi-layer mapping and similarity metric, and the score corresponding to each candidate entity is output.
[0068] The candidate entity scores are normalized and sorted, and the candidate entity with the highest score is selected as the target answer entity according to the sorting result.
[0069] Retrieve and output the corresponding answer text based on the unique identifier of the target answer entity in the pre-built dual-carbon knowledge graph.
[0070] The beneficial effects of this invention are:
[0071] This invention introduces a global embedding vector training mechanism based on the TransE model, which can effectively utilize the structural information in the pre-set two-carbon knowledge graph to represent entities and relationships in a low dimension. This provides unified and semantically discriminative initialization features for subsequent graph neural network computation, thereby improving the semantic expressive power and computational efficiency of problem-related two-carbon subgraphs.
[0072] By leveraging the CompGCN model to perform multi-level message passing and relation composition computation on problem-related bicarbon subgraphs, we not only fully explore the structural dependencies and semantic associations between entities in the knowledge graph, but also achieve comprehensive modeling of relation directionality, self-loops, and reverse edges through the construction of an enhanced adjacency structure. This makes node representations more context-aware and significantly enhances the representation capabilities of candidate entities.
[0073] This invention constructs an improved DeBERTa model that integrates external knowledge from ConceptNet. Through a dual mechanism of semantically enhanced embedding and syntactically aware positional encoding, it meticulously characterizes the lexical semantics and dependency structure information of the question text, effectively improving the language model's semantic understanding and syntactic parsing capabilities for complex questions. The syntactically aware positional term modeling introduced in the decoupled self-attention mechanism further enhances the model's perception of syntactic relationships between lexical units and the rationality of attention allocation.
[0074] This invention constructs a bidirectional cross-modal fusion mechanism to achieve vector space alignment and deep semantic interaction between question text representation and graph structure knowledge representation. It utilizes gated fusion and bidirectional attention computation to achieve precise matching between node representation and context representation, significantly improving the discrimination ability and ranking accuracy of candidate answer entities. This invention achieves deep integration of language understanding and structural knowledge, possessing stronger reasoning ability and answer accuracy, effectively overcoming the limitations of traditional question-answering systems in areas such as insufficient structural modeling, weak semantic perception, and inadequate knowledge utilization.
[0075] This invention is particularly applicable to intelligent question-and-answer scenarios in the dual-carbon field (carbon peaking and carbon neutrality), including enterprise carbon inventory consultation, ESG report Q&A, green factory application guidance, carbon neutrality policy compliance inquiry, and other dual-carbon business scenarios that require high levels of professional knowledge system and business logic modeling. It can significantly improve the professionalism, accuracy and intelligence level of question-and-answer systems in related fields. Attached Figure Description
[0076] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0077] Figure 1 This is an overall flowchart of a precise question-answering method based on knowledge graphs and large language models proposed in this invention;
[0078] Figure 2 This is an improved DeBERTa semantic enhancement embedding generation structure diagram of a precise question answering method based on knowledge graphs and large language models proposed in this invention;
[0079] Figure 3 This is a flowchart illustrating the context representation modeling based on syntactic-aware positional encoding, which is part of a precise question-answering method based on knowledge graphs and large language models proposed in this invention. Detailed Implementation
[0080] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0081] refer to Figure 1-3 A precise question-answering method based on knowledge graphs and large language models includes the following steps:
[0082] Perform text normalization processing on natural language questions in the two-carbon domain input by users, and complete the unification of two-carbon terminology, cleaning up invalid characters and standardizing the format;
[0083] The normalized text is segmented to obtain a two-carbon word sequence for natural language problems in the two-carbon domain; two-carbon domain term tagging and named entity recognition are performed on the two-carbon word sequence to extract the position index of the two-carbon entity and the two-carbon word sequence in the sequence.
[0084] Based on the identified dual-carbon entities, a corresponding set of candidate entities is generated from the pre-set dual-carbon knowledge graph entity namespace;
[0085] Entity disambiguation is performed on the candidate entity set. The candidate entities are scored and sorted based on the context window, lexical position, dependency relationship, connection structure and frequency of occurrence of the candidate entity in the pre-set two-carbon knowledge graph, and filtered and deduplicated according to the set threshold to retain the final entity.
[0086] The final entity is standardized as a unique identifier in a pre-built dual-carbon knowledge graph, and a mapping relationship is established between question words and the final entity.
[0087] Starting with the final entity set, perform subgraph retrieval in the pre-set dual-carbon knowledge graph, and obtain a subgraph containing the target entity, relationship and adjacency structure according to the set retrieval radius, relation type filtering and node and edge number limit;
[0088] The results retrieved from the subgraph are merged and structured to form a question-related double-carbon subgraph, and the double-carbon word sequence of the question, the final entity set, and the mapping relationship from word to entity are output.
[0089] In this embodiment, step one specifically includes:
[0090] Text normalization processing is performed on user-input natural language questions in the two-carbon domain, including character encoding unification, invalid character cleanup, and sentence segmentation;
[0091] The normalized two-carbon domain natural language problem text is segmented to obtain the problem two-carbon word sequence;
[0092] The question two-carbon word sequence is labeled, part-of-speech tagging and named entity recognition are completed, and entities and their position indices in the question two-carbon word sequence are extracted;
[0093] Based on the extracted entities, entity links are performed in the entity namespace of the pre-built dual-carbon knowledge graph, and a dual-carbon candidate entity set is generated according to alias mapping, homonym differentiation and unique identifier mapping.
[0094] The pre-built dual-carbon knowledge graph is constructed by fusing relevant domain knowledge from Wikidata and ConceptNet, and is generated by combining dual-carbon policy documents, industry standards, and research reports through technical steps such as entity recognition, relation extraction, and knowledge fusion. During the construction process, preprocessing operations such as naming standardization, noise filtering, and entity alignment are performed on all entities and relations to ensure the structural standardization and semantic consistency of the pre-built dual-carbon knowledge graph.
[0095] Disambiguation is performed on the dual-carbon candidate entity set. The candidate entities are scored and sorted based on the context window, word position and dependency information, as well as the connection relationship and frequency of occurrence of the candidate entities in the pre-set dual-carbon knowledge graph. The candidate entities are retained and deduplicated according to the set threshold.
[0096] The retained candidate entities are standardized as unique identifiers in a pre-built dual-carbon knowledge graph, and a mapping relationship between question terms and candidate entities is established.
[0097] Starting with the dual-carbon candidate entity set, a subgraph search is performed in the pre-set dual-carbon knowledge graph. Results containing the target entity, relationship and adjacency structure are obtained according to the set search radius, relation type filtering and upper limit of the number of nodes and edges.
[0098] The retrieved results are merged and structured to form a question-related two-carbon subgraph and output the question two-carbon word sequence, the two-carbon candidate entity set, and the mapping relationship from question words to candidate entities;
[0099] The dual-carbon sub-graph includes dual-carbon specific relationships such as "Carbon Inventory - Basis - ISO 14064" and "ESG Report - Includes - Environmental Dimension".
[0100] In this embodiment, step two specifically includes:
[0101] The TransE model is trained on the pre-set dual-carbon knowledge graph to obtain the global entity embedding vector corresponding to each entity and the global relation embedding vector corresponding to each relation, and an index table is established from the unique identifier of the pre-set dual-carbon knowledge graph to the embedding vector.
[0102] The global embedding vector set includes global entity embedding vectors and global relation embedding vectors;
[0103] The specific steps for training the TransE model on the pre-set dual-carbon knowledge graph are as follows:
[0104] Extract entities, relations, and triples with unique identifiers from the pre-built dual-carbon knowledge graph, complete duplicate item removal and data consistency verification, and divide the training set, validation set, and test set according to the set ratio;
[0105] Based on the training set, negative samples are generated for each triplet by replacing the head entity or the tail entity, and the ratio of the number of negative samples to positive samples and the sampling strategy are set.
[0106] Initialize the embedding dimension, learning rate, batch size, and training epochs of the TransE model, and randomly initialize the global entity embedding vector and global relation embedding vector;
[0107] The TransE model is trained in batch mode, and the discrimination error between positive and negative samples is minimized according to the objective optimization criterion based on distance ranking. The training process is monitored using a validation set and an early stopping strategy is executed. After training, the global entity embedding vector of each entity and the global relation embedding vector of each relation are fixed and stored, and an index table from the unique identifier of the global knowledge graph to the embedding vector is established.
[0108] Based on the corresponding identifiers of nodes and edges in the problem-related double-carbon subgraph in the pre-set double-carbon knowledge graph, the corresponding global relation embedding vectors are extracted from the index table to initialize the nodes and edges of the problem-related double-carbon subgraph.
[0109] The initialization process includes: extracting the corresponding global relation embedding vectors from the index table based on the unique identifiers of nodes and edges in the problem-related dual-carbon subgraph in the preset dual-carbon knowledge graph, and assigning the set of global embedding vectors to the nodes and edges in the problem-related dual-carbon subgraph respectively to form a problem-related dual-carbon subgraph with initial features;
[0110] For nodes and edges that do not exist in the index table, feature completion is performed using predefined placeholder embedding vectors, and the problem-related bicarbon subgraph with completed feature completion is output.
[0111] In this embodiment, the use of CompGCN to perform multi-level message passing and relation combination calculations on the problem-related bicarbon subgraph specifically includes:
[0112] Based on the problem-related bicarbon subgraph with initial features, perform graph structure construction operations to generate an enhanced adjacency structure;
[0113] The node feature matrix is composed of global entity embedding vectors, which are extracted and arranged according to the unique identifiers of nodes in the problem-related double-carbon subgraph.
[0114] The enhanced adjacency structure, node feature matrix, and global relation embedding vector are used as inputs to CompGCN. The number of layers, hidden dimensions, and relation combination operations of CompGCN are set. The relation combination operation is performed by concatenating the node features and relation vectors and then performing a linear transformation specific to the relation type.
[0115] Based on the set of incoming edges and relation types recorded in the enhanced adjacency structure, message passing and relation composition calculations are performed to obtain a node representation containing context structure information;
[0116] The node representations are indexed, aligned, and stored based on the set of two-carbon candidate entities, and then the node representations are output.
[0117] The message passing and relation combination calculation are as follows: During the message passing process from layer 1 to layer L, the source node features and corresponding relation vectors are combined according to the relation type of the incoming edges. After obtaining the edge messages, they are summed and aggregated according to the target node dimension to form the aggregation result of each node. The aggregation result is then subjected to linear transformation, nonlinear activation and normalization processing in sequence, and residual connection is performed with the node features of the previous layer. Random deactivation with a set drop rate is applied after each layer output. The problem-related double carbon subgraph is calculated in batches according to the set neighbor sampling width and batch processing scale until the message passing and relation combination calculation of layer L is completed.
[0118] After the output of the Lth layer, the node representation containing context structure information is obtained. The node representation is indexed, aligned and stored according to the dual-carbon candidate entity set. The node representation is then output to step six for vector space alignment, gating fusion and bidirectional attention interaction with the context representation.
[0119] The execution graph structure construction operation specifically includes:
[0120] Analyze the connection relationships between all nodes and edges in the problem-related bicarbon subgraph with initial features;
[0121] The analysis involves traversing the entity nodes and relation triples in the problem-related double-carbon subgraph with initial features, generating node-to-node connection indices based on the correspondence between the head entity, relation, and tail entity, establishing an adjacency list for each relation type, recording the corresponding reverse relation in the adjacency list, and adding a self-loop connection to each node.
[0122] This forms an adjacency structure that includes node indexes, relation indexes, and connection relationships.
[0123] After parsing, the adjacency list is divided according to the relation type, and an independent adjacency structure is established for each relation type;
[0124] Add a self-loop edge to each node, using that node as both the source and target node to form a self-connection relationship;
[0125] For each relation edge, generate a reverse relation edge with the opposite direction, and register the reverse connection in the adjacency structure;
[0126] After adding self-loop edges and reverse edges, the output is an enhanced adjacency structure that has been partitioned by relation type and expanded by direction.
[0127] In this embodiment, the construction of the semantically enhanced embedding of the improved DeBERTa specifically includes:
[0128] Based on the question's two-carbon word sequence and the two-carbon candidate entity set, determine the target word set for semantic enhancement;
[0129] Content embedding encoding of target lexical units is performed based on the improved DeBERTa vocabulary to obtain lexical content embeddings;
[0130] In the pre-built dual-carbon knowledge graph, the ConceptNet subset is called, and the corresponding concept identifiers are retrieved and concept vectors are extracted from the ConceptNet subset according to the mapping relationship between lexical text, lexical and candidate entities.
[0131] The concept identifier is a unique identifier for a node in the ConceptNet subset;
[0132] For lexical units for which no concept identifier can be retrieved, a predefined placeholder concept vector is set, and dimensional alignment is performed on the predefined placeholder concept vector to match the vector dimension of the lexical content embedding.
[0133] The predefined placeholder concept vectors are initialized by the dimensional mean of the concept vector set of the ConceptNet subset and participate in optimization as learnable parameters during the training of the improved DeBERTa model;
[0134] A gated fusion unit is constructed to receive word content embeddings and predefined placeholder concept vectors at the word unit granularity. The gate coefficients are calculated and the word content embeddings and predefined placeholder concept vectors are fused element by element to obtain semantically enhanced content embeddings.
[0135] Normalization and masking are performed on the semantically enhanced content embeddings to form the improved DeBERTa semantically enhanced embeddings;
[0136] The semantically enhanced embedding is output as the content embedding representation of the question.
[0137] This invention constructs an improved DeBERTa semantically enhanced embedding, combining a question's two-carbon lexical sequence with a two-carbon candidate entity set to determine target lexicals and encode their content. Simultaneously, it retrieves corresponding concept vectors from a pre-built two-carbon knowledge graph's ConceptNet subset. For lexicals for which concepts cannot be retrieved, predefined, learnable placeholder vectors are set and optimized. A gated fusion mechanism is used to fuse the lexical content embeddings and concept vectors element-wise, forming a semantically enhanced content embedding. This embedding is then normalized and masked before output, enhancing the model's ability to understand the semantics of the question.
[0138] In this embodiment, the use of syntactic-aware positional encoding in the improved DeBERTa specifically includes:
[0139] The improved DeBERTa performs word segmentation on the question text using a word segmenter, resulting in a sub-word level word sequence;
[0140] Receive semantically enhanced embeddings and question-based two-carbon word sequences, and build an index from word to text position;
[0141] Perform dependency parsing on the problem text to obtain the headword index, dependency relation label, and shortest path length based on the dependency tree for each word.
[0142] Align sub-word level words with dependency tree nodes, generate mappings from sub-word level words to dependency tree nodes according to a preset sub-word merging strategy, and register placeholder indexes for words that cannot be aligned.
[0143] A syntax-aware position index is constructed at the granularity of arbitrary word pairs. The syntax-aware position index is represented by a combination of relative syntactic distance, dependency direction information and dependency relation labels. Placeholder indexes are assigned to items that exceed the threshold or are missing.
[0144] The relative syntactic distance is calculated based on the shortest path length between two lexical units in the dependency tree;
[0145] The dependency direction information is determined based on the directional relationship between the headword and the dependency words in the dependency tree;
[0146] Based on the syntactic-aware position index, retrieve the syntactic-aware position embedding vector and complete the dimensional alignment and sequence alignment between the syntactic-aware position embedding vector and the semantically enhanced content embedding;
[0147] Within the decoupled self-attention layer of the improved DeBERTa, attention weights are calculated for content-to-content, content-to-location, and location-to-content, respectively.
[0148] The calculation of attention weights for content-to-content, content-to-position, and position-to-content is specifically as follows: Within the decoupled self-attention layer of the improved DeBERTa, for any query term and key term in the sub-word-level lexical sequence, the content embedding and syntactic-aware position embedding are used as inputs to calculate the three types of attention weights: content-to-content, content-to-position, and position-to-content. For each type of attention weight, a dot product is performed based on the query vector of the query term and the key vector of the key term, and the results are scaled and normalized to obtain the weighting coefficients of the three types of attention components. The corresponding content embedding and position embedding are weighted and summed according to the weighting coefficients to obtain the attention-weighted intermediate representation, and the results of the three types of attention components are fused to form the attention output of the current layer.
[0149] The attention weights are modeled using syntactic-aware position embedding to obtain a comprehensive attention score, and masks are applied to invalid and filled positions.
[0150] After the comprehensive attention score is output, the feedforward network, normalization and residual connection are executed in sequence, and the consistency of lexical and position index is maintained between layers;
[0151] The sub-word level lexical sequence is calculated layer by layer according to the set number of layers, and the output is a context representation containing syntactic dependency information.
[0152] This invention proposes to introduce a syntactic-aware positional encoding mechanism in an improved DeBERTa. By performing word segmentation and dependency parsing on the question text, the central word index, dependency relation labels, and shortest path length are extracted to construct a syntactic-aware positional index based on relative syntactic distance, dependency direction, and relation labels. A syntactic-aware positional embedding vector aligned with the semantic embedding of the word is then generated. In the decoupled self-attention mechanism, attention weights for content-to-content, content-to-position, and position-to-content are calculated separately. Semantic and syntactic information is fused to construct a comprehensive attention score. Invalid and padding positions are handled through a masking mechanism. Finally, after multi-layer attention calculation and residual connection, a contextual representation containing syntactic dependency information is output, thereby enhancing the language model's ability to understand and express the question structure.
[0153] In this embodiment, the step of modeling the positional terms of attention weights according to syntactic-aware positional embedding specifically includes:
[0154] For any query term and key term, calculate the attention score for the query term and key term;
[0155] The attention score consists of two parts. The first part is the dot product of the query vector and the key vector, which yields the semantic similarity term.
[0156] The second part is the position term, which is obtained by mapping the corresponding syntactic-aware position embedding vector through a linear transformation function.
[0157] The semantic similarity item is added to the position item to obtain the comprehensive attention score, which reflects both the semantic relevance and syntactic structure relationship between word units.
[0158] This invention introduces a positional term modeling mechanism in the improved DeBERTa, calculates attention scores for any query term and key term pair, uses the dot product of the query vector and key vector as a semantic similarity term, and generates positional terms by linearly transforming the corresponding syntactic-aware positional embedding vector. Finally, the two are added together to form a comprehensive attention score, effectively integrating semantic relevance and syntactic structure information between terms, thereby improving the model's ability to understand and express contextual dependencies.
[0159] In this embodiment, the bidirectional cross-modal fusion mechanism specifically includes:
[0160] Perform vector space alignment processing on the node representation and the context representation respectively. The vector space alignment includes dimensional projection, normalization and scale unification of the node representation and the context representation, and map the aligned node representation and the context representation to the same latent representation space.
[0161] The node-to-word pairing relationship is generated based on the candidate entity-to-node index and the word-to-position index, and a mask mark is registered for invalid pairings;
[0162] Perform bidirectional attention interaction, calculate the interaction weights in both directions (node to word and word to node), and set invalid pairs to an unparticipation state.
[0163] A gated fusion unit is constructed based on the bidirectional attention interaction results. The aligned node representation and context representation are received according to the pairing relationship. The gate coefficient is calculated and the aligned node representation and context representation are fused element by element to generate lexical-enhanced node representation and node-enhanced context representation.
[0164] The node representations enhanced by lexical elements are weighted and aggregated along the lexical dimension to obtain the candidate entity-level fusion representation, and the context representations enhanced by nodes are weighted and aggregated along the node dimension to obtain the sequence-level fusion representation.
[0165] The candidate entity-level fusion representation and the sequence-level fusion representation are matched and scored. The matching and scoring are performed sequentially through a learnable multi-layer mapping and similarity metric, and the score corresponding to each candidate entity is output.
[0166] The matching score includes: performing linear mapping and nonlinear transformation on the candidate entity-level fusion representation and the sequence-level fusion representation respectively, and projecting the transformation results onto a unified similarity metric space; calculating the similarity between the candidate entity-level fusion representation and the sequence-level fusion representation in the similarity metric space, and generating a matching score for the candidate entity based on the similarity result; performing normalization processing on the matching scores of all candidate entities, and outputting the final score corresponding to each candidate entity.
[0167] The candidate entity scores are normalized and sorted, and the candidate entity with the highest score is selected as the target answer entity according to the sorting result.
[0168] Retrieve and output the corresponding answer text based on the unique identifier of the target answer entity in the pre-built dual-carbon knowledge graph.
[0169] This invention proposes an answer selection method based on a bidirectional cross-modal fusion mechanism. By constructing a pairing relationship between node representations and context representations, and based on vector space alignment, it relies on bidirectional attention interaction and gating fusion units to achieve deep interaction and complementary enhancement of semantic information. It generates lexical-enhanced node representations and node-enhanced context representations, respectively. Furthermore, it performs matching and scoring through learnable multi-layer mapping and similarity measurement, and normalizes and sorts candidate entities. Finally, it determines the optimal answer entity and outputs the corresponding answer text, which significantly improves the accuracy and expressive ability of the question answering system under multi-source heterogeneous information fusion.
[0170] Example 1:
[0171] To verify the feasibility of this invention in practice, it was applied to an intelligent question-and-answer system, providing high-precision answer recommendation services when users ask questions related to a specific field. This question-and-answer system is deployed on a government service platform, primarily providing natural language question-and-answer support for policy interpretation, service handling guides, and legal searches to public users.
[0172] In real-world scenarios, users may ask questions such as "How should enterprises conduct carbon inventory checks?", "How can enterprises align their carbon neutrality targets with SBTi standards?", "What carbon emission data needs to be disclosed in the environmental dimension of ESG reports?", and "What are the energy consumption standards for applying for provincial green factory status?". Traditional keyword-matching question-answering systems often suffer from insufficient information recall, semantic misunderstanding, and an inability to handle ambiguous entities when dealing with these questions. This results in irrelevant answers and severely generalized returned content, significantly impacting the user experience.
[0173] To address the aforementioned issues, the question-answering method of this invention is based on knowledge graphs and large language models, incorporating structured semantic modeling, graph neural network reasoning, and syntactic-aware representation learning to effectively enhance the system's comprehension and reasoning abilities. The specific process is as follows:
[0174] Upon receiving a user-inputted natural language question in the dual-carbon domain, the system performs text preprocessing, including normalization, word segmentation, named entity recognition, entity linking, and disambiguation. This constructs a dual-carbon candidate entity set, and relevant subgraphs are retrieved from the knowledge graph. For the question "How to apply for unemployment benefits," the system identifies the keywords "unemployment benefits" and "apply" and links them to relevant entity nodes in the knowledge graph. This leads to the construction of a subgraph centered on "unemployment benefits," containing multi-hop relationships related to relevant regulations, conditions, procedures, and institutions.
[0175] The system initializes the embedded representations of entities and relations in the knowledge graph using a pre-trained TransE model, and generates node representations containing semantic context through multi-layer graph information transfer and relation combination via CompGCN. Simultaneously, the system processes question text based on an improved DeBERTa model, constructs semantically enhanced content embeddings by fusing external concept information from ConceptNet, and introduces syntactic-aware positional encoding. It models inter-lexical dependencies within a decoupled self-attention mechanism, enhancing the language model's ability to represent long-distance structural dependencies.
[0176] During the fusion phase, the system utilizes a bidirectional cross-modal mechanism to spatially align the graph structure node representation with the language context representation, perform bidirectional attention interaction and gating fusion, and calculate the matching degree between each candidate entity and the context through a multi-layer matching and scoring module, thereby achieving accurate answer location.
[0177] To verify the effectiveness of this method, the system was tested in three real-world user scenarios: government services, medical insurance Q&A, and human resources and social security policy Q&A. It was also compared with three existing mainstream question-answering systems: a BERT-based retrieval question-answering system, a TextCNN-based classification system, and a Seq2Seq-based generation system. A total of 12,400 question-answer samples were collected, with manually labeled reference answers. Evaluation was performed using metrics such as Top-1 precision, Top-3 recall, and average response time. Specific experimental data is shown in Table 1.
[0178] Table 1. Performance comparison experimental results of the method of the present invention in multi-scenario question answering tasks.
[0179] Scene type Method type Top-1 accuracy (%) Top-3 recall rate (%) Average response time (ms) Number of questions Error rate (%) Government services Method of the present invention 86.3 95.1 843 4200 3.7 Government services BERT Search Questions 75.8 89.4 1026 4200 6.5 Government services TextCNN Classification Questions and Answers 69.1 83.3 913 4200 9.1 Medical Insurance Q&A Method of the present invention 83.7 92.6 861 4100 4.1 Medical Insurance Q&A Seq2Seq Generative Model 72.2 87.9 1285 4100 8.2 Human Resources and Social Security Policy Method of the present invention 84.2 93.4 847 4100 3.9 Human Resources and Social Security Policy BERT Search Questions 74.5 88.3 1011 4100 6.8
[0180] The results in Table 1 demonstrate that the proposed method achieves significant advantages in all test scenarios. In the government service scenario, the Top-1 accuracy reaches 86.3%, and the Top-3 recall is as high as 95.1%. In medical insurance Q&A, the accuracy is 83.7%, and the recall is 92.6%. In the human resources and social security policy scenario, it also achieves an accuracy of 84.2% and a recall of 93.4%. Furthermore, regarding average response time, due to the adoption of graph subgraph pruning and parallel computing optimization strategies, the response latency is consistently controlled within 850 milliseconds, representing an average improvement of approximately 27.4% compared to traditional methods.
[0181] This invention not only significantly improves the semantic understanding and reasoning capabilities of question-answering systems, but also outperforms existing solutions in multiple metrics. It has good generalization performance and engineering application value, and can effectively support the application of complex semantic question-answering tasks in real-world scenarios.
[0182] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
Claims
1. A precise question-answering method based on knowledge graphs and large language models, characterized in that, Includes the following steps: Step 1: Obtain the user-input natural language question in the dual-carbon domain, perform dual-carbon scenario preprocessing on the dual-carbon domain natural language question, and generate a dual-carbon candidate entity set; Subgraph retrieval is performed on a pre-built dual-carbon knowledge graph based on a dual-carbon candidate entity set to obtain a question-related dual-carbon subgraph. Step 2: Train the TransE model on the pre-set dual-carbon knowledge graph to obtain a global embedding vector set; based on the question-related dual-carbon subgraph, extract the corresponding entity embedding vector and relation embedding vector from the global embedding vector set; Step 3: Use CompGCN to perform message passing and relation combination calculations on the problem-related bicarbon subgraph to generate node representations containing contextual structure information; Step 4: Construct an improved DeBERTa semantically enhanced embedding, gating and fusing the lexical units of the question text with the corresponding concept vectors in the external knowledge base ConceptNet, and outputting the content embedding representation of the question text; Step 5: In the improved DeBERTa, syntactic-aware positional encoding is used to perform dependency parsing to obtain the dependency relationships and dependency distances between lexical units. Positional encoding is generated based on the dependency information and used to decouple self-attention computation, outputting the contextual representation of the question. Step 6: Execute a bidirectional cross-modal fusion mechanism to align the node representation with the context representation in vector space, perform gating fusion and bidirectional attention interaction to generate a fused representation; score and rank the candidate entities based on the fused representation, determine the target answer entity and output the corresponding answer text.
2. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, Step one specifically includes: Perform text normalization processing on natural language questions in the two-carbon domain input by users, and complete the unification of two-carbon terminology, cleaning up invalid characters and standardizing the format; The normalized text is segmented to obtain a two-carbon word sequence for natural language problems in the two-carbon domain; two-carbon domain term tagging and named entity recognition are performed on the two-carbon word sequence to extract the position index of the two-carbon entity and the two-carbon word sequence in the sequence. Based on the identified dual-carbon entities, a corresponding set of candidate entities is generated from the pre-set dual-carbon knowledge graph entity namespace; Entity disambiguation is performed on the candidate entity set. The candidate entities are scored and sorted based on the context window, lexical position, dependency relationship, connection structure and frequency of occurrence of the candidate entity in the pre-set two-carbon knowledge graph, and filtered and deduplicated according to the set threshold to retain the final entity. The final entity is standardized as a unique identifier in a pre-built dual-carbon knowledge graph, and a mapping relationship is established between question words and the final entity. Starting with the final entity set, perform subgraph retrieval in the pre-set dual-carbon knowledge graph, and obtain a subgraph containing the target entity, relationship and adjacency structure according to the set retrieval radius, relation type filtering and node and edge number limit; The results retrieved from the subgraph are merged and structured to form a question-related double-carbon subgraph, and the double-carbon word sequence of the question, the final entity set, and the mapping relationship from word to entity are output.
3. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, Step two specifically includes: The TransE model is trained on the pre-set dual-carbon knowledge graph to obtain the global entity embedding vector corresponding to each entity and the global relation embedding vector corresponding to each relation, and an index table is established from the unique identifier of the pre-set dual-carbon knowledge graph to the embedding vector. The global embedding vector set includes global entity embedding vectors and global relation embedding vectors; Based on the corresponding identifiers of nodes and edges in the problem-related dual-carbon subgraph in the pre-set dual-carbon knowledge graph, the corresponding global entity embedding vectors and global relation embedding vectors are extracted from the index table to initialize the nodes and edges of the problem-related dual-carbon subgraph. The initialization process includes: extracting the corresponding global entity embedding vector and global relation embedding vector from the index table based on the unique identifiers of nodes and edges in the problem-related dual-carbon subgraph in the preset dual-carbon knowledge graph, and assigning them to the nodes and edges in the problem-related dual-carbon subgraph respectively to form a problem-related dual-carbon subgraph with initial features; For nodes and edges that do not exist in the index table, feature completion is performed using predefined placeholder embedding vectors, and the problem-related bicarbon subgraph with completed feature completion is output.
4. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, The method of using CompGCN to perform message passing and relation combination calculations on problem-related bicarbon subgraphs specifically includes: Based on the problem-related bicarbon subgraph with initial features, perform graph structure construction operations to generate an enhanced adjacency structure; The node feature matrix is composed of global entity embedding vectors, which are extracted and arranged according to the unique identifiers of nodes in the problem-related double-carbon subgraph. The enhanced adjacency structure, node feature matrix, and global relation embedding vector are used as inputs to CompGCN, and the number of layers, hidden dimensions, and relation combination operations of CompGCN are set. Based on the set of incoming edges and relation types recorded in the enhanced adjacency structure, message passing and relation composition calculations are performed to obtain a node representation containing context structure information; Based on the set of candidate entities in the two-carbon graph, the node representations are indexed, aligned, and stored. A one-to-one correspondence table between the candidate entities and the nodes in the problem-related two-carbon subgraph is established. The correspondence table is registered as the node index, and the node representations are output.
5. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, The construction of the semantically enhanced embedding of the improved DeBERTa specifically includes: Based on the question's two-carbon word sequence and the two-carbon candidate entity set, determine the target word set for semantic enhancement; Content embedding encoding of target lexical units is performed based on the improved DeBERTa vocabulary to obtain lexical content embeddings; In the pre-built dual-carbon knowledge graph, the ConceptNet subset is called, and the corresponding concept identifiers are retrieved and concept vectors are extracted from the ConceptNet subset according to the mapping relationship between word text, word and candidate entity; The concept identifier is a unique identifier for a node in the ConceptNet subset; For lexical units for which no concept identifier can be retrieved, a predefined placeholder concept vector is set, and dimensional alignment is performed on the predefined placeholder concept vector to match the vector dimension of the lexical content embedding. The predefined placeholder concept vectors are initialized by the dimensional mean of the concept vector set of the ConceptNet subset and participate in optimization as learnable parameters during the training of the improved DeBERTa model; A gated fusion unit is constructed to receive word content embeddings and predefined placeholder concept vectors at the word unit granularity. The gate coefficients are calculated and the word content embeddings and predefined placeholder concept vectors are fused element by element to obtain semantically enhanced content embeddings. Normalization and masking are performed on the semantically enhanced content embeddings to form the improved DeBERTa semantically enhanced embeddings; The semantically enhanced embedding is output as the content embedding representation of the question.
6. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, The use of syntactic-aware positional encoding in the improved DeBERTa specifically includes: The improved DeBERTa performs word segmentation on the question text using a word segmenter, resulting in a sub-word level word sequence; Perform dependency parsing on the problem text to obtain the headword index, dependency relation label, and shortest path length based on the dependency tree for each word. Align sub-word level words with dependency tree nodes, generate mappings from sub-word level words to dependency tree nodes according to a preset sub-word merging strategy, and register placeholder indexes for words that cannot be aligned. A syntax-aware position index is constructed at the granularity of arbitrary word pairs. The syntax-aware position index is represented by a combination of relative syntactic distance, dependency direction information and dependency relation labels. Placeholder indexes are assigned to items that exceed the threshold or are missing. Based on the syntactic-aware position index, retrieve the syntactic-aware position embedding vector and complete the dimensional alignment and sequence alignment between the syntactic-aware position embedding vector and the semantically enhanced content embedding; Within the decoupled self-attention layer of the improved DeBERTa, attention weights are calculated for content-to-content, content-to-location, and location-to-content, respectively. The attention weights are modeled using syntactic-aware position embedding to obtain a comprehensive attention score, and masks are applied to invalid and filled positions. Guided by the comprehensive attention score, the semantically enhanced content embeddings of all sub-word-level lexical sequences are weighted and aggregated to generate the contextual intermediate representation of the current layer; The intermediate context representation is sequentially fed into the feedforward network, normalized and residual connections, and the consistency of lexical and position indexes is maintained between layers; The process involves sequentially performing comprehensive attention score calculation, feedforward network, normalization, and residual connection on the sub-word-level word sequence according to the set number of layers, and outputting a context representation containing syntactic dependency information.
7. The precise question-answering method based on knowledge graphs and large language models according to claim 6, characterized in that, The step of modeling the positional terms of attention weights according to syntactic-aware positional embedding specifically includes: For any query term and key term, calculate the attention score for the query term and key term; The attention score consists of two parts. The first part is the dot product of the query vector and the key vector, which yields the semantic similarity term. The second part is the position term, which is obtained by mapping the corresponding syntactic-aware position embedding vector through a linear transformation function. The semantic similarity term and the position term are added together to obtain the comprehensive attention score.
8. The precise question-answering method based on knowledge graphs and large language models according to claim 1, characterized in that, The bidirectional cross-modal fusion mechanism specifically includes: Perform vector space alignment processing on the node representation and the context representation respectively. The vector space alignment includes dimensional projection, normalization and scale unification of the node representation and the context representation, and map the aligned node representation and the context representation to the same latent representation space. The node-to-word pairing relationship is generated based on the candidate entity-to-node index and the word-to-position index, and a mask mark is registered for invalid pairings; Perform bidirectional attention interaction, calculate the interaction weights in both directions (node to word and word to node), and set invalid pairs to an unparticipation state. A gated fusion unit is constructed based on the bidirectional attention interaction results. The aligned node representation and context representation are received according to the pairing relationship. The gate coefficient is calculated and the aligned node representation and context representation are fused element by element to generate lexical-enhanced node representation and node-enhanced context representation. The node representations enhanced by lexical elements are weighted and aggregated along the lexical dimension to obtain the candidate entity-level fusion representation, and the context representations enhanced by nodes are weighted and aggregated along the node dimension to obtain the sequence-level fusion representation. The fusion representation is a candidate entity-level fusion representation and a sequence-level fusion representation; The fused representation is used for matching and scoring. The matching and scoring is performed sequentially through a learnable multi-layer mapping and similarity metric, and the score corresponding to each candidate entity is output. The candidate entity scores are normalized and sorted, and the candidate entity with the highest score is selected as the target answer entity according to the sorting result. Retrieve and output the corresponding answer text based on the unique identifier of the target answer entity in the pre-built dual-carbon knowledge graph.