A bilingual question-answering method based on collaborative training of knowledge retrieval and generation
By introducing hierarchical semantic aggregation, cross-source adaptive gating, and causal bias retrieval mechanisms, the problems of knowledge point dispersion and language alignment difficulties in cross-language knowledge-enhanced question answering systems are solved, improving the stability of knowledge retrieval and the interpretability of answers. In particular, it improves the accuracy and robustness of the question answering system in Tibetan-Chinese contexts.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU UNIVERSITY OF TECHNOLOGY
- Filing Date
- 2026-03-23
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies in cross-language knowledge-enhanced question answering systems suffer from problems such as scattered knowledge points, unstable recall, and difficulty in language alignment, making it difficult to meet the needs of high-precision multi-turn reasoning, especially in low-resource language environments such as Tibetan.
We employ hierarchical semantic aggregation, cross-source adaptive gating, and causal bias retrieval mechanisms. We generate semantic prototype vectors through regularized hierarchical clustering, construct a cross-linguistic knowledge graph, use the Notears causal algorithm to generate a causal graph, construct a knowledge retrieval enhancement model, and combine it with a large language model for answer generation.
It improves the quality and application value of cross-linguistic knowledge-enhanced question-answering systems, enhances the stability and semantic consistency of knowledge retrieval, and improves the interpretability of answers and the accuracy of reasoning. In particular, it significantly improves the robustness of question-answering systems in the case of misalignment between Tibetan and Chinese meanings.
Smart Images

Figure CN121919329B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent question answering technology, and in particular to a bilingual question answering method based on collaborative training of knowledge retrieval and generation. Background Technology
[0002] With the rapid development of cross-lingual knowledge graphs and large language model technologies, knowledge-enhanced question-answering systems have demonstrated enormous potential in multilingual retrieval, intelligent reasoning, and low-resource language understanding. As a knowledge-enhanced generative model, the Tibetan-Chinese cross-lingual knowledge-enhanced question-answering method, by introducing hierarchical semantic aggregation, cross-source adaptive gating, and causal bias retrieval mechanisms, not only significantly improves the robustness and knowledge coverage of the question-answering system but also ensures multilingual semantic consistency and the interpretability of the generated results, thereby promoting the development of multilingual intelligent question answering and knowledge fusion. In cross-lingual question-answering scenarios, ensuring the quality of knowledge retrieval and structured fusion is crucial for performing semantic reasoning and information extraction, especially in low-resource language environments like Tibetan, where question-answering tasks often require semantic alignment, causal understanding, and knowledge updates to meet the demands of high-precision, multi-turn reasoning.
[0003] However, the limitations of existing technologies have led to persistent problems such as scattered knowledge points, unstable recall, and difficulties in language alignment. Further addressing these shortcomings is an urgent issue to be resolved.
[0004] Definitions:
[0005] The Notears causal algorithm is a continuous optimization-based causal discovery method used to automatically learn directed acyclic graphs (DAGs), or causal graphs, between variables from observed data. A DAG is a mathematical structure representing causal relationships, consisting of nodes, directed edges (causal edges), and is acyclic (prohibiting causal loops). Causal edges have corresponding weights, and a causal transition matrix can be constructed based on these weights. Summary of the Invention
[0006] The purpose of this invention is to provide a bilingual question answering method based on knowledge retrieval and generation collaborative training, which solves the above-mentioned problems by introducing hierarchical semantic aggregation, cross-source adaptive gating and causal bias retrieval mechanisms to improve the quality and application value of cross-language knowledge-enhanced question answering systems.
[0007] To achieve the above objectives, the technical solution adopted by this invention is as follows: a bilingual question-answering method based on knowledge retrieval and generation collaborative training, comprising the following steps:
[0008] S1, obtain the corpus g0 and the question-answer database based on g0. g0 includes Chinese and Tibetan corpora, and the question-answer database includes question-answer pairs in Chinese and Tibetan.
[0009] S2, map the sentences in g0 to the same semantic space to obtain the semantic encoding vector of each sentence, and form a set A of all semantic encoding vectors;
[0010] S3. Perform regularized hierarchical clustering on set A to obtain K clusters, and generate the semantic prototype vector r of cluster c. c , 1≤c≤K;
[0011] S4, extract triples from g0 to form a cross-language knowledge graph g1, and generate a DAG graph based on the Notears causal algorithm as a causal graph g2 to form the retrieval source set G={g0,g1,g2}.
[0012] S5, for the question q in the question-answering database, the corresponding sentences in the corpus are labeled as the sample set C of q. q The questions are divided into several categories, and the main search source g is specified for each category. best g best ∈G;
[0013] S6, Construct a knowledge retrieval enhancement model, including S61~S65;
[0014] S61, Construct a gated network to select a predictive primary retrieval source for question q;
[0015] S62, Construct importance probability generation units, including Sa1~Sa2;
[0016] Sa1, select entities from g1 according to the following formula to form a seed set V0;
[0017] ,
[0018] sim kg (q,v) represents the structural similarity between entity v in problem q and g1, and cos(e) q ,r c (e) is the semantic encoding vector of question q. q With r c Cosine similarity, TopK v (∙), TopK c (∙) represents taking the largest K respectively. V One and K c indivual;
[0019] Sa2 calculates the PageRank value of each entity in V0 and uses the PageRank value of entity v as its importance probability Cen(v);
[0020] S63, construct structured prompt generation units, including Sb1~Sb4;
[0021] Sb1, generate the optimal evidence subgraph entity set S according to the following formula. g ;
[0022] ,
[0023] In the formula, z v Let be the encoded embedding of entity v generated by the GNN network, Cred(v) be the source confidence of the manually labeled entity v, and η1~η4 be the fusion weights of the corresponding multiplication terms. For S g The number of entities in the evidence subgraph, where K is the upper limit of the number of entities in the evidence subgraph, and max is the maximum value;
[0024] Sb2, from g0, based on s g The inner triplet value and token cost select sentences to form the core reasoning chain C1, sentences based on semantic similarity select sentences to form vector retrieval results C2, and sentences based on causal path select sentences to form causal reasoning evidence C3.
[0025] Sb3 constructs a structured prompt, Prompt = [Task||q||C1||C2||C3], where Task is the task instruction description and || is the concatenation operation;
[0026] S64, obtain a large language model, which is used to generate the answer y according to the Prompt;
[0027] S65 combines a gating network, an importance probability generation unit, a structured prompt generation unit, and a large language model to form a knowledge retrieval enhancement model.
[0028] S7 trains a knowledge retrieval enhancement model based on a question-answering database, and adjusts the parameters of the gating network and the large language model to obtain a bilingual question-answering model for use in intelligent question answering.
[0029] As a preferred embodiment, the semantic encoding vector of the generated sentence in S2 is specifically generated as follows: the Chinese corpus and the Tibetan corpus are segmented and denoised to obtain a total of M sentences in Chinese and Tibetan. Each sentence is mapped to the same semantic space using a cross-language semantic encoding model to obtain the semantic encoding vector corresponding to each sentence. The cross-language semantic encoding model is the LASER2 model.
[0030] As a preferred option, in S3, regularized hierarchical clustering is performed according to the following formula;
[0031] ,
[0032] ,
[0033] In the formula, x m Let m be the semantic encoding vector of the m-th sentence in set A. Let λ be the cluster center of cluster c. sim The coefficients for the inter-cluster similarity regularization term are used for all clusters except cluster c. , for The cluster center, For c and Inter-cluster similarity, , c, respectively Number of internal semantic encoding vectors, x i Let x be the i-th semantic encoding vector in c. j For clusters The j-th semantic encoding vector in the vector is cos(∙,∙), which is used to calculate the cosine similarity.
[0034] In S3, the semantic prototype vector of cluster c is generated according to the following formula. , 1≤c≤K;
[0035] ,
[0036] In the formula, Normalize(·) is the Normalize function.
[0037] Preferably, in S61, the gating network is a cross-source adaptive gating network, and the method for outputting the predicted main retrieval source is as follows:
[0038] Sc1 calculates the semantic similarity sim between q and sentence s in the corpus. txt (q,s)=cos(e q ,x s The structural similarity sim between entity v in q and g1 kg (q,v)=cos(e q ,z v Causal similarity between causal paths π in q and g2 ;
[0039] In the formula, e q x s Z represents the semantic encoding vectors of question q and sentence s, respectively. v Let w be the encoded embedding of entity v generated by a GNN network, (u→v) be the set of causal edges in π from entity u to entity v, and w be the coded embedding of entity v. c Here, represents the weight of the causal edge, and cos(∙,∙) is used to calculate the cosine similarity.
[0040] Sc2, calculate the gating distribution γ according to the following formula:
[0041] ,
[0042] In the formula, W[∙] are the linear transformation parameters, and softmax(∙) is the softmax function. , , sim txt (q,s), sim kg (q,v), sim cau The maximum value of (q,π), src cred The credibility scores for each search source are manually verified.
[0043] Sc3 uses the retrieval source corresponding to the maximum value of the median γ as the predicted primary retrieval source.
[0044] Preferably, Sa2 includes the following steps;
[0045] Sa2-1: Generate the transition matrix P of V0 based on the PageRank algorithm, and generate the causal transition matrix P of V0 according to the causal edge weights. c ;
[0046] Sa2-2: According to Generate an optimized transition matrix In the formula, β is the mixture coefficient of structure and causality and β∈[0,1];
[0047] Sa2-3: Use Replace P to generate the PageRank values for each entity in V0.
[0048] As a preferred embodiment, in Sb2, the specific method for generating C1 is as follows:
[0049] For S g For each triple u, calculate the value V(u) and the token cost l(u).
[0050] V(u)=λ a score(u)+λ b InfoGain(u|U), l(u)=Tokens(u), where score(u) is the static score of manually labeled u, and U is the tokens constructed from S. g The evidence subgraph formed by entities containing u without u being included in the process, where InfoGain(u|U) is the marginal information gain of adding u to U, and λ a , λ b These are the weights of the corresponding multiplication terms, and l(u) is the number of tokens in the sentence set in the corpus corresponding to triple u;
[0051] Given a total cost L, select the most valuable triples within L and construct the core inference chain C1 from the sentences in the corresponding corpus.
[0052] Sb2 is preferred.
[0053] The specific steps for generating C2 are as follows: a preset semantic similarity threshold is set, and semantic encoding vectors with a semantic similarity to question q that is higher than the threshold are found in set A, and their corresponding sentences are used to form the vector retrieval result C2.
[0054] The specific process for generating C3 is as follows: find the causal path π containing q from the causal graph, and construct the causal reasoning evidence C3 by matching the sentences corresponding to the entities in π in the corpus.
[0055] As a preferred option, in S7, the total loss L is minimized. total Training the knowledge retrieval enhancement model, L total The construction methods include S71~S73;
[0056] S71, the sentences corresponding to question q in the corpus are labeled as the sample set C. q The set C formed by C1~C3 all If C all The sentence in question belongs to category C. q Then it is marked as a positive sample e. + Otherwise, it is a negative sample e - ;
[0057] S72, Construct the comprehensive retrieval loss L rank and gate loss L gate ;
[0058] ,
[0059] In the formula, , Let be the positive sample set and the negative sample set, respectively; let score(∙) be the scoring function based on the large language model; let σ(⋅) be the Sigmoid function; and let γ be the negative sample set. s In the gated distribution γ output by the gated network for question q, the predicted probability value corresponding to the true primary retrieval source of q is given.
[0060] S73, Total Construction Loss L total L total =L rank +λ g L gate +λ y L gen L gate For the gating loss of the gating network, L gen λ represents the loss of the large language model in generating answers. g , λ y L respectively gate and L gen The weight.
[0061] Preferably, step S8 is also included, in intelligent question answering, generating new triples based on the answer y. Perform a rule consistency check; if it passes, Updated to g1.
[0062] Compared with the prior art, the advantages of the present invention are as follows:
[0063] (1) By introducing hierarchical semantic aggregation and inter-cluster similarity regularization mechanisms, the model can effectively improve the aggregation stability of scattered knowledge. This mechanism introduces inter-cluster constraints into the vector clustering objective, generating topic-level semantic prototype vectors for each cluster. This not only improves the quality of recall but also ensures the consistency of cross-language semantic aggregation, providing a solid foundation for knowledge retrieval and topic structuring.
[0064] (2) A cross-source adaptive gating mechanism is introduced as a key step in the retrieval stage, enabling the system to automatically select the optimal information path among the three retrieval sources: the corpus, knowledge graph g1, and causal graph g2. By dynamically adjusting the retrieval weights through trainable gating parameters, the system not only focuses on the global relevance of questions but also accurately captures fine-grained causal chains and structural knowledge, significantly improving the reasoning accuracy of multilingual question answering. Especially in applications where Tibetan and Chinese meanings are misaligned, this technology effectively improves the interpretability and robustness of the answers.
[0065] (3) Construct a personalized PageRank algorithm with causal bias. Referring to steps Sa2-1 to Sa2-3, this invention introduces a causal transition matrix P based on the existing PageRank algorithm. c ,calculate Replace the transition matrix P in the original PageRank algorithm to generate PageRank values for each entity in the seed set V0, guiding the generation of the optimal evidence subgraph S. g And in S g Based on value and total cost, semantic similarity, and causal path, C1, C2, and C3 are generated to construct structured prompts. These are then input into the generative model, a large language model, to generate bilingual answers. This improves the relevance of retrieval evidence and the efficiency of information utilization, and enhances the accuracy, interpretability, and cross-language consistency of answer generation.
[0066] (4) The total loss includes the comprehensive retrieval loss, the gating loss, and the generation loss of the large language model, realizing comprehensive control from evidence retrieval, main retrieval source selection and answer generation.
[0067] (5) After generating an answer in the intelligent question answering system, it can also generate new triples based on the answer. The system performs rule consistency checks, and updates the knowledge graph g1 after passing the checks, thus achieving a self-learning cycle from evidence retrieval and answer generation to knowledge updating.
[0068] In summary, this invention significantly improves the quality and application value of cross-lingual knowledge-enhanced question-answering systems by introducing hierarchical semantic aggregation, cross-source adaptive gating, and causal bias retrieval mechanisms, providing an innovative solution for multilingual knowledge reasoning and intelligent retrieval. By addressing existing problems such as knowledge dispersion, language alignment, and self-learning updates, this method offers a new technical path for low-resource cross-lingual question answering, with particularly broad application prospects in Tibetan-Chinese bilingual knowledge services, document retrieval, and intelligent education systems. Attached Figure Description
[0069] Figure 1 This is a flowchart of the present invention;
[0070] Figure 2 A structural diagram of the knowledge retrieval enhancement model. Detailed Implementation
[0071] The present invention will be further described below with reference to the embodiments and accompanying drawings.
[0072] Example 1: See Figure 1 and Figure 2 A bilingual question-answering method based on knowledge retrieval and generation collaborative training includes the following steps:
[0073] S1, obtain the corpus g0 and the question-answer database based on g0. g0 includes Chinese and Tibetan corpora, and the question-answer database includes question-answer pairs in Chinese and Tibetan.
[0074] S2, map the sentences in g0 to the same semantic space to obtain the semantic encoding vector of each sentence, and form a set A of all semantic encoding vectors;
[0075] S3. Perform regularized hierarchical clustering on set A to obtain K clusters, and generate the semantic prototype vector r of cluster c. c , 1≤c≤K;
[0076] S4, extract triples from g0 to form a cross-language knowledge graph g1, and generate a DAG graph based on the Notears causal algorithm as a causal graph g2 to form the retrieval source set G={g0,g1,g2}.
[0077] S5, for the question q in the question-answering database, the corresponding sentences in the corpus are labeled as the sample set C of q. q The questions are divided into several categories, and the main search source g is specified for each category. best g best ∈G;
[0078] S6, Construct a knowledge retrieval enhancement model, including S61~S65;
[0079] S61, Construct a gated network to select a predictive primary retrieval source for question q;
[0080] S62, Construct importance probability generation units, including Sa1~Sa2;
[0081] Sa1, select entities from g1 according to the following formula to form a seed set V0;
[0082] ,
[0083] sim kg (q,v) represents the structural similarity between entity v in problem q and g1, and cos(e) q ,r c (e) is the semantic encoding vector of question q. q With r c Cosine similarity, TopK v (∙), TopK c (∙) represents taking the largest K respectively. V One and K c indivual;
[0084] Sa2 calculates the PageRank value of each entity in V0 and uses the PageRank value of entity v as its importance probability Cen(v);
[0085] S63, construct structured prompt generation units, including Sb1~Sb4;
[0086] Sb1, generate the optimal evidence subgraph entity set S according to the following formula. g ;
[0087] ,
[0088] In the formula, z v Let be the encoded embedding of entity v generated by the GNN network, Cred(v) be the source confidence of the manually labeled entity v, and η1~η4 be the fusion weights of the corresponding multiplication terms. For S g The number of entities in the evidence subgraph, where K is the upper limit of the number of entities in the evidence subgraph, and max is the maximum value;
[0089] Sb2, from g0, based on s g The inner triplet value and token cost select sentences to form the core reasoning chain C1, sentences based on semantic similarity select sentences to form vector retrieval results C2, and sentences based on causal path select sentences to form causal reasoning evidence C3.
[0090] Sb3 constructs a structured prompt, Prompt = [Task||q||C1||C2||C3], where Task is the task instruction description and || is the concatenation operation;
[0091] S64, obtain a large language model, which is used to generate the answer y according to the Prompt;
[0092] S65 combines a gating network, an importance probability generation unit, a structured prompt generation unit, and a large language model to form a knowledge retrieval enhancement model.
[0093] S7 trains a knowledge retrieval enhancement model based on a question-answering database, and adjusts the parameters of the gating network and the large language model to obtain a bilingual question-answering model for use in intelligent question answering.
[0094] In this embodiment, the semantic encoding vector of the generated sentence in S2 is specifically as follows: the Chinese corpus and the Tibetan corpus are segmented and denoised to obtain a total of M sentences in Chinese and Tibetan. Each sentence is mapped to the same semantic space using a cross-language semantic encoding model to obtain the semantic encoding vector corresponding to each sentence. The cross-language semantic encoding model is the LASER2 model.
[0095] This is because the Tibetan corpus is limited in size, sparsely labeled, and structurally irregular, while the Chinese corpus is large in size and semantically rich. To ensure the system's cross-linguistic performance, Tibetan and Chinese corpora need to be cleaned, aligned, and hybrid embedded before mapping sentences in g0 to the same semantic space. Then, the LASER2 model is used to generate unified semantic encoding vectors to construct a cross-linguistic representation space, which is the present invention set A, for subsequent knowledge extraction and retrieval.
[0096] Example 2, see Figures 1-2 Regarding S3, regularized hierarchical clustering is performed according to the following formula;
[0097] ,
[0098] ,
[0099] In the formula, x m Let m be the semantic encoding vector of the m-th sentence in set A. Let λ be the cluster center of cluster c. sim The coefficients for the inter-cluster similarity regularization term are used for all clusters except cluster c. , for The cluster center, For c and Inter-cluster similarity, , c, respectively Number of internal semantic encoding vectors, xi Let x be the i-th semantic encoding vector in c. j For clusters The j-th semantic encoding vector in the vector is cos(∙,∙), which is used to calculate the cosine similarity.
[0100] And generate the semantic prototype vector of cluster c according to the following formula. , 1≤c≤K;
[0101] ,
[0102] In the formula, Normalize(·) is the Normalize function. Example 2 is otherwise the same as Example 1.
[0103] Example 3: See Figures 1-2 Based on Example 1 or Example 2, regarding step S6:
[0104] In S61, the gating network is a cross-source adaptive gating network, and the method for outputting the prediction of the main retrieval source is as follows:
[0105] Sc1 calculates the semantic similarity sim between q and sentence s in the corpus. txt (q,s)=cos(e q ,x s The structural similarity sim between entity v in q and g1 kg (q,v)=cos(e q ,z v Causal similarity between causal paths π in q and g2 ;
[0106] In the formula, e q x s Z represents the semantic encoding vectors of question q and sentence s, respectively. v Let w be the encoded embedding of entity v generated by a GNN network, (u→v) be the set of causal edges in π from entity u to entity v, and w be the coded embedding of entity v. c Here, represents the weight of the causal edge, and cos(∙,∙) is used to calculate the cosine similarity.
[0107] Sc2, calculate the gating distribution γ according to the following formula:
[0108] ,
[0109] In the formula, W[∙] are the linear transformation parameters, and softmax(∙) is the softmax function. , , sim txt (q,s), sim kg (q,v), simcau The maximum value of (q,π), src cred The credibility scores for each search source are manually verified.
[0110] Sc3 uses the retrieval source corresponding to the maximum value of the median γ as the predicted primary retrieval source.
[0111] Step Sa2 of S62 includes the following steps;
[0112] Sa2-1: Generate the transition matrix P of V0 based on the PageRank algorithm, and generate the causal transition matrix P of V0 according to the causal edge weights. c ;
[0113] Sa2-2: According to Generate an optimized transition matrix In the formula, β is the mixture coefficient of structure and causality and β∈[0,1];
[0114] Sa2-3: Use Replace P to generate the PageRank values for each entity in V0.
[0115] In step Sb2 of S63, the specific steps for generating C1 are as follows:
[0116] Sb2-1, for S g For each triple u, calculate the value V(u) and the token cost l(u).
[0117] V(u)=λ a score(u)+λ b InfoGain(u|U), l(u)=Tokens(u), where score(u) is the static score of manually labeled u, and U is the tokens constructed from S. g The evidence subgraph formed by entities containing u without u being included in the process, where InfoGain(u|U) is the marginal information gain of adding u to U, and λ a , λ b These are the weights of the corresponding multiplication terms, and l(u) is the number of tokens in the sentence set in the corpus corresponding to triple u;
[0118] Sb2-2, with a preset total cost L, selects the most valuable triples within L and uses their corresponding sentences from the corpus to form the core inference chain C1.
[0119] For example: Given a total cost L = 20, and problem q corresponds to S... g There are 3 triples. Calculate the value and token cost of each triple.
[0120] Triple 1, value 8, token cost 10;
[0121] Triple 2, value 9, token cost 12;
[0122] Triplet 3, value 5, length 8;
[0123] Option 1: Combine triples 1 and 2, the total token cost is 22 > 20;
[0124] Option 2: Combine triples 2 and 3, the total value is 14, and the total token cost is 20;
[0125] Option 3: Combine triples 1 and 3, the total value is 13, and the total token cost is 18;
[0126] This invention stipulates that the most valuable triples are selected within the total overhead L. Among the three combinations, scheme 2 satisfies the above conditions better. Therefore, the sentences corresponding to triples 2 and 3 in the corpus are used to form the core reasoning chain C1.
[0127] The specific process for generating C2 is as follows: a preset semantic similarity threshold is set, and semantic encoding vectors with a semantic similarity to question q that is higher than the threshold are found from set A. The corresponding sentences are then used to construct the vector retrieval result C2.
[0128] The specific process for generating C3 is as follows: find the causal path π containing q from the causal graph, and construct the causal reasoning evidence C3 by matching the sentences corresponding to the entities in π in the corpus.
[0129] In S7, the goal is to minimize the total loss L. total Training the knowledge retrieval enhancement model, L total The construction methods include S71~S73;
[0130] S71, the sentences corresponding to question q in the corpus are labeled as the sample set C. q The set C formed by C1~C3 all If C all The sentence in question belongs to category C. q Then it is marked as a positive sample e. + Otherwise, it is a negative sample e - ;
[0131] S72, Construct the comprehensive retrieval loss L rank and gate loss L gate ;
[0132] ,
[0133] In the formula, , Let be the positive sample set and the negative sample set, respectively; let score(∙) be the scoring function based on the large language model; let σ(⋅) be the Sigmoid function; and let γ be the negative sample set. sIn the gated distribution γ output by the gated network for question q, the predicted probability value corresponding to the true primary retrieval source of q is given.
[0134] S73, Total Construction Loss L total L total =L rank +λ g L gate +λ y L gen L gate For the gating loss of the gating network, L gen λ represents the loss of the large language model in generating answers. g , λ y L respectively gate and L gen The weight.
[0135] Example 4: See Figures 1-2 Based on Examples 1-3, in addition to steps S1-S7, step S8 is also included: in intelligent question answering, a new triplet is generated based on the answer y. Perform a rule consistency check; if it passes, Update to g1. Regarding rule consistency, multiple rules can be manually defined, for example, three rules can be defined as follows:
[0136] Rule 1: The head entity must be of type "Environmental Factors";
[0137] Rule 2: The tail entity must be of the "Disease" type;
[0138] Rule 3: The direction of the "cause" relationship must be cause → effect.
[0139] If a triple satisfies rules 1 through 3, then the corresponding scores Rule1 through Rule3 are recorded as 1; otherwise, they are recorded as 0. For example, a triple (wheat root rot, leading to, prolonged waterlogging) satisfies all rules 1 through 3, then Rule1=1, Rule2=1, and Rule3=1. Calculate the rule consistency check result p. cons =1×1×1=1 indicates that the rule consistency check passed, and the triple (wheat root rot, causing, long-term waterlogging) is updated to g1. If this triple does not satisfy any of the rules, then p cons =0 indicates that the rule consistency check failed and will not be updated in g1.
[0140] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A bilingual question-answering method based on collaborative training of knowledge retrieval and generation, characterized in that, Includes the following steps: S1, obtain the corpus g0 and the question-answer database based on g0. g0 includes Chinese and Tibetan corpora, and the question-answer database includes question-answer pairs in Chinese and Tibetan. S2, map the sentences in g0 to the same semantic space to obtain the semantic encoding vector of each sentence, and form a set A of all semantic encoding vectors; S3. Perform regularized hierarchical clustering on set A to obtain K clusters, and generate the semantic prototype vector r of cluster c. c , 1≤c≤K; S4, extract triples from g0 to form a cross-language knowledge graph g1, and generate a DAG graph based on the Notears causal algorithm as a causal graph g2 to form the retrieval source set G={g0,g1,g2}. S5, for the question q in the question-answering database, the corresponding sentences in the corpus are labeled as the sample set C of q. q The questions are divided into several categories, and the main search source g is specified for each category. best g best ∈G; S6, Construct a knowledge retrieval enhancement model, including S61~S65; S61, Construct a gated network to select a predictive primary retrieval source for question q; S62, Construct importance probability generation units, including Sa1~Sa2; Sa1, select entities from g1 according to the following formula to form a seed set V0; , sim kg (q,v) represents the structural similarity between entity v in problem q and g1, and cos(e) q ,r c (e) is the semantic encoding vector of question q. q With r c Cosine similarity, TopK v (∙), TopK c (∙) represents taking the largest K respectively. V One and K c indivual; Sa2 calculates the PageRank value of each entity in V0 and uses the PageRank value of entity v as its importance probability Cen(v); S63, construct structured prompt generation units, including Sb1~Sb4; Sb1, generate the optimal evidence subgraph entity set S according to the following formula. g ; , In the formula, z v Let be the encoded embedding of entity v generated by the GNN network, Cred(v) be the source confidence of the manually labeled entity v, and η1~η4 be the fusion weights of the corresponding multiplication terms. For S g The number of entities in the evidence subgraph, where K is the upper limit of the number of entities in the evidence subgraph, and max is the maximum value; Sb2, from g0, based on s g The inner triplet value and token cost select sentences to form the core reasoning chain C1, sentences based on semantic similarity select sentences to form vector retrieval results C2, and sentences based on causal path select sentences to form causal reasoning evidence C3. Sb3 constructs a structured prompt, Prompt = [Task||q||C1||C2||C3], where Task is the task instruction description and || is the concatenation operation; S64, obtain a large language model, which is used to generate the answer y according to the Prompt; S65 combines a gating network, an importance probability generation unit, a structured prompt generation unit, and a large language model to form a knowledge retrieval enhancement model. S7 trains a knowledge retrieval enhancement model based on a question-answering database, and adjusts the parameters of the gating network and the large language model to obtain a bilingual question-answering model for use in intelligent question answering.
2. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, The semantic encoding vector of the sentence generated in S2 is specifically as follows: the Chinese and Tibetan corpora are segmented and denoised to obtain a total of M sentences in Chinese and Tibetan. Each sentence is mapped to the same semantic space using a cross-language semantic encoding model to obtain the semantic encoding vector corresponding to each sentence. The cross-language semantic encoding model is the LASER2 model.
3. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, In S3, regularized hierarchical clustering is performed according to the following formula; , , In the formula, x m Let m be the semantic encoding vector of the m-th sentence in set A. Let λ be the cluster center of cluster c. sim The coefficients for the inter-cluster similarity regularization term are used for all clusters except cluster c. , for The cluster center, For c and Inter-cluster similarity, , c, respectively Number of internal semantic encoding vectors, x i Let x be the i-th semantic encoding vector in c. j For clusters The j-th semantic encoding vector in the vector is cos(∙,∙), which is used to calculate the cosine similarity. In S3, the semantic prototype vector of cluster c is generated according to the following formula. , 1≤c≤K; , In the formula, Normalize(·) is the Normalize function.
4. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, In S61, the gating network is a cross-source adaptive gating network, and the method for outputting the prediction of the main retrieval source is as follows: Sc1 calculates the semantic similarity sim between q and sentence s in the corpus. txt (q,s)=cos(e q ,x s The structural similarity sim between entity v in q and g1 kg (q,v)=cos(e q ,z v Causal similarity between causal paths π in q and g2 ; In the formula, e q x s Z represents the semantic encoding vectors of question q and sentence s, respectively. v Let w be the encoded embedding of entity v generated by a GNN network, (u→v) be the set of causal edges in π from entity u to entity v, and w be the coded embedding of entity v. c Here, represents the weight of the causal edge, and cos(∙,∙) is used to calculate the cosine similarity. Sc2, calculate the gating distribution γ according to the following formula: , In the formula, W[∙] are the linear transformation parameters, and softmax(∙) is the softmax function. , , sim txt (q,s), sim kg (q,v), sim cau The maximum value of (q,π), src cred The credibility scores for each search source are manually verified. Sc3 uses the retrieval source corresponding to the maximum value of the median γ as the predicted primary retrieval source.
5. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, Sa2 includes the following steps; Sa2-1: Generate the transition matrix P of V0 based on the PageRank algorithm, and generate the causal transition matrix P of V0 according to the causal edge weights. c ; Sa2-2: According to Generate an optimized transition matrix In the formula, β is the mixture coefficient of structure and causality and β∈[0,1]; Sa2-3: Use Replace P to generate the PageRank values for each entity in V0.
6. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, In Sb2, the specific steps for generating C1 are as follows: For S g For each triple u, calculate the value V(u) and the token cost l(u). V(u)=λ a score(u)+λ b InfoGain(u|U), l(u)=Tokens(u), where score(u) is the static score of manually labeled u, and U is the tokens for constructing S. g The evidence subgraph formed by entities containing u without u being included in the process, where InfoGain(u|U) is the marginal information gain of adding u to U, and λ a , λ b These are the weights of the corresponding multiplication terms, and l(u) is the number of tokens in the sentence set in the corpus corresponding to triple u; Given a total cost L, select the most valuable triples within L and construct the core inference chain C1 from the sentences in the corresponding corpus.
7. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, In Sb2; The specific steps for generating C2 are as follows: a preset semantic similarity threshold is set, and semantic encoding vectors with a semantic similarity to question q that is higher than the threshold are found in set A, and their corresponding sentences are used to form the vector retrieval result C2. The specific process for generating C3 is as follows: find the causal path π containing q from the causal graph, and construct the causal reasoning evidence C3 by matching the sentences corresponding to the entities in π in the corpus.
8. The bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, In S7, the goal is to minimize the total loss L. total Training the knowledge retrieval enhancement model, L total The construction methods include S71~S73; S71, the sentences corresponding to question q in the corpus are labeled as the sample set C. q The set C formed by C1~C3 all If C all The sentence in question belongs to category C. q Then it is marked as a positive sample e. + Otherwise, it is a negative sample e - ; S72, Construct the comprehensive retrieval loss L rank and gate loss L gate ; , In the formula, , Let be the positive sample set and the negative sample set, respectively; let score(∙) be the scoring function based on the large language model; let σ(⋅) be the Sigmoid function; and let γ be the negative sample set. s In the gated distribution γ output by the gated network for question q, the predicted probability value corresponding to the true primary retrieval source of q is given. S73, Total Construction Loss L total L total =L rank +λ g L gate +λ y L gen L gate For the gating loss of the gating network, L gen λ represents the loss of the large language model in generating answers. g , λ y L respectively gate and L gen The weight.
9. A bilingual question-answering method based on knowledge retrieval and generation collaborative training according to claim 1, characterized in that, It also includes step S8, in intelligent question answering, generating new triples based on the answer y. Perform a rule consistency check; if it passes, Updated to g1.
Citation Information
Patent Citations
Retrieval enhancement generation method and device, electronic equipment, medium and program product
CN120670548A
Multi-modal heterogeneous model retrieval enhancement method and system
CN120929616A