Cross-domain large model method and system based on federated rag
Through a federated RAG architecture, the server identifies the intent of natural language queries and determines the target client, the client performs local retrieval and security processing, and the server merges the results to generate the answer. This solves the data privacy and domain knowledge barrier problems of centralized RAG systems and achieves depth and accuracy in cross-domain knowledge collaboration and answer generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
- Filing Date
- 2026-02-06
- Publication Date
- 2026-05-01
AI Technical Summary
Existing centralized RAG systems pose risks of data privacy breaches and domain knowledge barriers in cross-domain applications, failing to effectively utilize high-value data, resulting in limited knowledge coverage and a lack of depth and professionalism in generated answers.
The system adopts a federated RAG architecture. The server performs semantic parsing and intent recognition on natural language queries to identify target clients and distributes retrieval requests to clients in parallel for local retrieval and security processing. The server integrates multi-source results to generate answers and uses homomorphic encryption and knowledge distillation techniques to ensure data security.
It enables cross-domain knowledge collaboration, breaks down data silos, enhances cross-domain cognition and decision-making capabilities, generates in-depth, accurate and coherent answers, and ensures data privacy and compliance.
Smart Images

Figure CN121660106B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and large model technology, and in particular to a cross-domain large model method and system based on federated RAG. Background Technology
[0002] In recent years, with the rapid development of large-scale models and artificial intelligence technologies, various large language models have emerged. Meanwhile, retrieval-enhanced generation technology, as a core technology supporting the development of large language models, has been widely applied in various specialized fields such as law, finance, healthcare, manufacturing, urban governance, and cultural tourism. However, while various large language model technologies are iterating and upgrading, the process of industrial intelligence is placing higher demands on their cross-domain collaborative capabilities.
[0003] Currently, mainstream Retrieval-augmented Generation (RAG) systems generally adopt a centralized architecture, which aggregates data from various fields to a central server to build a unified retrieval library. This architecture poses risks of data privacy breaches and faces compliance barriers under laws and regulations when dealing with cross-domain needs. Due to data security laws, industry regulations, and trade secrets, core private data in fields such as healthcare and finance constitute data silos, making it impossible to legally and compliantly centralize them with third parties. This prevents centralized RAGs from utilizing this high-value data, resulting in limited knowledge coverage. Secondly, there are domain knowledge barriers and performance degradation. A retrieval and generation model trained on general corpora or single-domain data struggles to accurately understand the specialized terminology, internal logic, and contextual relationships of another domain. This leads to decreased accuracy in cross-domain retrieval, and the generated answers lack depth and professionalism, failing to form an effective closed loop in complex decision-making chains. Summary of the Invention
[0004] In view of this, the present invention provides a cross-domain large model method and system based on federated RAG to achieve effective cross-domain knowledge collaboration.
[0005] In a first aspect, the present invention provides a cross-domain large model method based on federated RAG, the method comprising:
[0006] Step 1: Query reception and parsing. The server performs semantic parsing and intent recognition on the received natural language query, and extracts key entities, domain keywords and semantic features from the query.
[0007] Step 2: Identify the target client. Based on semantic parsing and intent recognition, the server matches the queried semantic features with a predefined domain knowledge graph. Based on the decision result, a routing instruction is generated to identify one or more target clients.
[0008] Step 3: Federated search request distribution. The server executes routing instructions to distribute natural language queries in parallel to one or more target clients through a secure communication channel.
[0009] Step 4: Local retrieval and security processing. The client receives the retrieval request, performs vector similarity calculation and keyword retrieval, obtains an initial set of knowledge fragments, processes them, and returns the processed intermediate results to the server.
[0010] Step 5: Multi-source result fusion. The server receives intermediate results from multiple clients and fuses them to obtain an enhanced context document.
[0011] Step 6: Generate the answer. The server generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query.
[0012] Step 7: Return the result. Return the natural language answer to the server to complete a cross-domain question-and-answer interaction.
[0013] Optionally, step 1 includes:
[0014] First, text preprocessing is performed to clean the input query text, including removing irrelevant characters, standardizing the encoding format, and performing word segmentation. Next, key entities and domain keywords are extracted using a pre-trained natural language processing model. Simultaneously, terms highly relevant to the predefined domain are identified through a domain keyword dictionary or TF-IDF statistical methods. Then, semantic feature extraction and intent recognition are performed. The pre-processed query text is input into a pre-trained semantic encoding model, which transforms the query into a high-dimensional dense vector, i.e., the query semantic vector. The query semantic vector contains the semantic information of the query; intent recognition is achieved through a classification method, which involves training an intent classifier to map queries to predefined intent categories; the intent classifier is a machine learning model trained under supervised learning, and the intent classifier uses the query semantic vector generated by the semantic encoding model. As input features, they are processed by a fully connected neural network classification layer, and finally the output layer obtains the probability distribution of each predefined intent category. The intent classifier is obtained by training the model using historical query data with labeled intent categories. The intent categories it identifies, together with the key entities, domain keywords and semantic features extracted from the query, serve as a comprehensive basis for dynamic routing decisions.
[0015] Optionally, step 2 includes:
[0016] By calculating the query semantic vector With each domain description vector Cosine similarity, as a matching score The calculation formula is as follows:
[0017] ;
[0018] in, This represents the description vector of the i-th domain;
[0019] Based on the matching score, determine one or more target domains related to the current query; based on the decision result, generate routing instructions to identify one or more target clients.
[0020] Optionally, step 4 includes:
[0021] The initial knowledge fragment is encrypted using a homomorphic encryption algorithm to form a ciphertext fragment. The formal representation of the encryption process is as follows:
[0022] ;
[0023] Where M represents the initial knowledge fragment. C is the public key, C is the ciphertext fragment; Enc represents the encryption function of the homomorphic encryption algorithm;
[0024] Sensitive entities in the initial knowledge fragments are desensitized to generate non-sensitive text;
[0025] Knowledge distillation technology is used to compress initial knowledge fragments into condensed representations that retain core semantics.
[0026] Optionally, step 5 includes:
[0027] a. Decryption and parsing; If the intermediate result is ciphertext or distilled representation, then decryption or parsing to restore it is performed first. The decryption process is as follows:
[0028] ;
[0029] in, C represents the private key; C represents the ciphertext fragment; Dec represents the mathematical operation process used to receive the private key. Using the ciphertext fragment C as input, the previous encryption process is reversed through a cryptographic algorithm;
[0030] b. Deduplication; Based on text fingerprints or semantic similarity, remove duplicate knowledge fragments;
[0031] c. Sorting; based on relevance scores to the original query. Source, client credibility weight and the novelty of knowledge fragments All knowledge fragments are comprehensively re-ranked; the final ranking score for each knowledge fragment is... Calculated using the following weighted formula:
[0032] ;
[0033] in, These are adjustable weighting coefficients used to balance the importance of different ranking factors, and Its value is determined through empirical setting or optimization on a validation set;
[0034] The sorting process is the core step in multi-source result fusion processing, aiming to filter and integrate complementary knowledge. Its configuration methods include the following:
[0035] Experience setting: determined based on the experience of domain experts or preliminary experiments;
[0036] Optimization learning: On a small-scale labeled dataset, with the quality of the final answer as the optimization objective, the optimal weight combination is learned through grid search, Bayesian optimization or gradient descent methods.
[0037] d. Collage; Collage the top-ranked knowledge fragments into a unified, enhanced contextual document;
[0038] Correlation score The semantic relevance score between the fragment and the query is generated during client-side retrieval or recalculated by the server-side cross-encoder model. Specifically, during local client-side retrieval, an initial relevance score is generated for each retrieved knowledge fragment to characterize its relevance to the query through vector similarity calculation or retrieval model. The initial relevance score is returned to the server along with intermediate results or obtained by the server-side cross-encoder model re-scoring the knowledge fragment and the query.
[0039] Credibility weight To evaluate static or dynamic values based on clients, initial weights are pre-set according to factors such as the client's authority, the quality of historical responses, and the frequency of data updates, and are dynamically adjusted based on feedback from historical interactions.
[0040] Novelty This is used to measure the degree of information addition of the current fragment relative to the previously considered fragments, and to measure whether the information provided by the knowledge fragment is repetitive or complementary to other selected fragments; it is determined by calculating the semantic similarity between the current fragment and the top-ranked fragments, or by detecting whether it contains new entities or relationships. Its expression is:
[0041] = 1-max(similarity(current segment, selected segment)), where max represents the maximum value function.
[0042] Optionally, step 6 includes:
[0043] The goal of the natural language answer generation process is to maximize the generated answer sequence Y in a given enhanced context document. Given the probability under query Q, this process is formalized as maximizing the log-likelihood of the generated answer sequence Y, expressed as:
[0044] ;
[0045] in, This represents the t-th word in the sequence of generated answers; Indicates in generation All previously generated word sequences, excluding t; Indicates in a given enhanced context Query Q and the currently generated partial answer sequence Under the condition that the model predicts the next word as The conditional probability.
[0046] Secondly, the present invention provides a cross-domain large model system based on federated RAG, the system being used to implement the cross-domain large model method based on federated RAG described in the first aspect, the system comprising:
[0047] The system consists of a server and a client. The server comprises four modules: a dynamic routing decision-maker, a federated aggregator, a large language model, and a server communication interface. The client comprises four modules: a local private knowledge base, a local retrieval unit, a security processing unit, and a client communication interface.
[0048] The server-side communication interface is used to receive natural language queries, and the dynamic routing decision-maker is used to perform semantic parsing and intent recognition on the received natural language queries, extracting key entities, domain keywords and semantic features from the queries;
[0049] Based on semantic parsing and intent recognition, the dynamic routing decision-maker is also used to match the semantic features of the query with a predefined domain knowledge graph; based on the decision result, it generates routing instructions and identifies one or more target clients;
[0050] The server-side communication interface is also used to execute routing instructions, distributing natural language queries in parallel to one or more target clients through a secure communication channel;
[0051] The client communication interface is used to receive search requests, the local searcher is used to perform vector similarity calculation and keyword search in the local private knowledge base to obtain an initial set of knowledge fragments, and the security processing unit is used to process the initial set of knowledge fragments; the client communication interface is also used to return the processed intermediate results to the server communication interface.
[0052] The federated aggregator is used to receive intermediate results from multiple client communication interfaces through the server-side communication interface, and to merge the intermediate results to obtain an enhanced context document.
[0053] The large language model is used to receive the enhanced context document output by the federated aggregator and the original query; the large language model generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query;
[0054] The server-side communication interface is also used to return natural language answers generated by the large language model to complete a cross-domain question-and-answer interaction.
[0055] Optionally, the dynamic routing decision-maker includes a query parsing unit, a vectorization submodule, a domain matching unit, and a routing instruction generation unit;
[0056] The query parsing unit receives natural language queries through the server communication interface. First, text preprocessing is performed, which involves removing illegal characters, standardizing encoding, and word segmentation. Then, a pre-trained Named Entity Recognition (NER) model is used to extract key entities from the query, and a domain keyword database is used to identify relevant domain terms. Simultaneously, a pre-trained semantic encoding model converts the query text into a high-dimensional semantic vector. That is, query semantic vector , Used to capture deep semantic information and potential intent of queries; intent recognition is based on Intent classification model implementation, or through computation The similarity with the preset intent template vector is used to complete the process; the domain matching unit pre-sets a domain knowledge graph, in which each registered domain has a corresponding static domain description vector. , It is generated from authoritative descriptive texts in the domain using the same semantic encoding model.
[0057] Optionally, the federated aggregator consists of a result receiving buffer, a secure morphology conversion unit, a multi-scale deduplication module, a multi-factor reordering engine, and a context splicer; the result receiving buffer maintains a receiving buffer for each client connection and sets a timeout mechanism; the secure morphology conversion unit first calls the decryption interface of the homomorphic encryption library for the ciphertext fragment C, using the private key held by the system. The knowledge fragment M is decrypted and restored to its original form. For the condensed representation formed by knowledge distillation, the corresponding parsing model is invoked to restore it to a semantically complete textual representation. The parsing model is a trained neural network module whose function is to restore or generate a semantically complete and readable summary textual representation from the low-dimensional semantic condensed representation for subsequent fusion processing.
[0058] The technical solution provided by this invention includes a method for query reception and parsing. The server performs semantic parsing and intent recognition on the received natural language query, extracting key entities, domain keywords, and semantic features from the query. Target clients are determined; based on semantic parsing and intent recognition, the server matches the semantic features of the query with a predefined domain knowledge graph. Based on the decision result, routing instructions are generated to determine one or more target clients. Federated retrieval request distribution occurs; the server executes the routing instructions, distributing the natural language query in parallel to one or more target clients through a secure communication channel. Local retrieval and secure processing occur; the client receives the retrieval request, performs vector similarity calculation and keyword retrieval to obtain an initial set of knowledge fragments, and processes them. The processed intermediate results are returned to the server. Multi-source result fusion occurs; the server receives intermediate results from multiple clients and fuses them to obtain an enhanced context document. Answer generation occurs; the server generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query. Result return occurs; the natural language answer is returned to the server to complete a cross-domain question-and-answer interaction. This method achieves effective cross-domain knowledge collaboration. Attached Figure Description
[0059] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0060] Figure 1 A flowchart illustrating the cross-domain large model method based on federated RAG provided in this embodiment of the invention;
[0061] Figure 2 This is a schematic diagram of a cross-domain large model system based on federated RAG provided in an embodiment of the present invention. Detailed Implementation
[0062] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” used in the embodiments of this invention are also intended to include the plural forms unless the context clearly indicates otherwise.
[0064] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0065] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."
[0066] Figure 1 A flowchart of the cross-domain large model method based on federated RAG provided in the embodiments of the present invention is shown below. Figure 1 As shown, the method includes:
[0067] Step 1: Query reception and parsing. The server performs semantic parsing and intent recognition on the received natural language query, and extracts key entities, domain keywords and semantic features from the query.
[0068] In this embodiment of the invention, step 1 includes:
[0069] First, text preprocessing is performed to clean the input query text, including removing irrelevant characters, standardizing the encoding format (e.g., converting to UTF-8), and word segmentation. Next, key entities and domain keywords are extracted using a pre-trained natural language processing model (e.g., identifying named entities in the query using a Transformer-based NER model, such as the disease name "myocardial infarction"), while simultaneously identifying terms highly relevant to the predefined domain using a domain keyword dictionary or TF-IDF statistical methods. Then, semantic feature extraction and intent recognition are performed. The pre-processed query text is input into a pre-trained semantic encoding model (e.g., Sentence-BERT), which converts the query into a high-dimensional dense vector, i.e., the query semantic vector. The query semantic vector contains the semantic information of the query; intent recognition is achieved through a classification method, which involves training an intent classifier to map the query to a predefined intent category (such as "disease diagnosis consultation"); the intent classifier is a machine learning model trained under supervised learning, specifically, the intent classifier uses the query semantic vector generated by the semantic encoding model. As input features, they are processed by a fully connected neural network classification layer, and finally the output layer obtains the probability distribution of each predefined intent category. The intent classifier is obtained by training the model using historical query data with labeled intent categories. The intent categories it identifies, together with the key entities, domain keywords and semantic features extracted from the query, serve as a comprehensive basis for dynamic routing decisions.
[0070] Step 2: Identify the target client. Based on semantic parsing and intent recognition, the server matches the queried semantic features with a predefined domain knowledge graph. Based on the decision result, a routing instruction is generated to identify one or more target clients.
[0071] In this embodiment of the invention, step 2 includes:
[0072] By calculating the query semantic vector With each domain description vector Cosine similarity, as a matching score The calculation formula is as follows:
[0073] ;
[0074] in, This represents the description vector of the i-th domain;
[0075] Based on the matching score, determine one or more target domains related to the current query; based on the decision result, generate routing instructions to identify one or more target clients.
[0076] Step 3: Federated search request distribution. The server executes routing instructions to distribute natural language queries in parallel to one or more target clients through a secure communication channel.
[0077] Step 4: Local retrieval and security processing. The client receives the retrieval request, performs vector similarity calculation and keyword retrieval, obtains an initial set of knowledge fragments, processes them, and returns the processed intermediate results to the server.
[0078] In this embodiment of the invention, step 4 includes:
[0079] The initial knowledge fragment is encrypted using a homomorphic encryption algorithm to form a ciphertext fragment. The formal representation of the encryption process is as follows:
[0080] ;
[0081] Where M represents the initial knowledge fragment. C is the public key, C is the ciphertext fragment; Enc represents the encryption function of the homomorphic encryption algorithm;
[0082] Sensitive entities in the initial knowledge fragments are desensitized to generate non-sensitive text;
[0083] Knowledge distillation technology is used to compress initial knowledge fragments into condensed representations that retain core semantics.
[0084] Step 5: Multi-source result fusion. The server receives intermediate results from multiple clients and performs fusion processing on the intermediate results to obtain an enhanced context document.
[0085] In this embodiment of the invention, step 5 includes:
[0086] a. Decryption and parsing; If the intermediate result is ciphertext or distilled representation, then decryption or parsing to restore it is performed first. The decryption process is as follows:
[0087] ;
[0088] in, C represents the private key; C represents the ciphertext fragment; Dec represents the mathematical operation process used to receive the private key. The ciphertext fragment C is used as input, and the previous encryption process is reversed using a cryptographic algorithm (such as the Paillier homomorphic encryption scheme);
[0089] b. Deduplication; Based on text fingerprints or semantic similarity, remove duplicate knowledge fragments;
[0090] c. Sorting; based on relevance scores to the original query. Source, client credibility weight and the novelty of knowledge fragments All knowledge fragments are comprehensively re-ranked; the final ranking score for each knowledge fragment is... Calculated using the following weighted formula:
[0091] ;
[0092] in, These are adjustable weighting coefficients used to balance the importance of different ranking factors, and Its specific value is determined through empirical setting or optimization on a validation set;
[0093] In this embodiment of the invention, the sorting is the core step in the multi-source result fusion processing, aiming to filter and integrate the most relevant, reliable, and complementary knowledge. Its setting method includes the following:
[0094] Experience setting: determined based on the experience of domain experts or preliminary experiments;
[0095] Optimization learning: On small-scale labeled datasets, with the quality of the final answer (such as ROUGE score, human rating) as the optimization objective, the optimal weight combination is learned through grid search, Bayesian optimization or gradient descent methods;
[0096] d. Collage; Collage the top-ranked knowledge fragments into a unified, enhanced contextual document.
[0097] Correlation score This refers to the semantic relevance score between the fragment and the query, generated during client-side retrieval or recalculated by the server-side cross-encoder model. Specifically, during local client-side retrieval, an initial relevance score is generated for each retrieved knowledge fragment using vector similarity calculations (such as cosine similarity) or a retrieval model (such as BM25). This initial relevance score is then returned to the server along with intermediate results, or obtained by the server-side cross-encoder model re-scoring the knowledge fragment and query.
[0098] Credibility weight It is a static or dynamic evaluation value based on the client (data source). The initial weight is set in advance according to factors such as the client's authority, the quality of historical answers, and the frequency of data updates, and is dynamically adjusted according to feedback from historical interactions (such as user ratings of answers).
[0099] Novelty This is used to measure the degree of information addition of the current fragment relative to the previously considered fragments, and to measure whether the information provided by the knowledge fragment is repetitive or complementary to other selected fragments; it is determined by calculating the semantic similarity (inverse) between the current fragment and the top-ranked fragments, or by detecting whether it contains new entities or relations. Its expression is:
[0100] = 1-max(similarity(current segment, selected segment)), where max represents the maximum value function.
[0101] Step 6: Generate the answer. The server uses the enhanced context document. Semantic parsing and context-aware reasoning are performed on the original query Q to generate a natural language answer.
[0102] The server-side large language model receives the enhanced context document output by the federated aggregator. The original query Q is then subjected to semantic parsing and context-aware reasoning using a large language model. This reasoning includes logical association, information induction, and causal inference, ultimately generating a natural language answer that corresponds to the query and is based on the context.
[0103] In this embodiment of the invention, step 6 includes:
[0104] The goal of the natural language answer generation process is to maximize the generated answer sequence Y in a given enhanced context document. Given the probability under query Q, this process is formalized as maximizing the log-likelihood of the generated answer sequence Y, expressed as:
[0105] ;
[0106] in, This represents the t-th word in the sequence of generated answers; Indicates in generation All previously generated word sequences, excluding t; Indicates in a given enhanced context Query Q and the currently generated partial answer sequence Under the condition that the model predicts the next word as The conditional probability.
[0107] Step 7: Return the result. Return the natural language answer to the server to complete a cross-domain question-and-answer interaction.
[0108] In this embodiment of the invention,
[0109] This invention provides a cross-domain large model system based on federated RAG, which is used to implement the aforementioned cross-domain large model method based on federated RAG. The system includes:
[0110] The system consists of a server and a client. The server comprises four modules: a dynamic routing decision-maker, a federated aggregator, a large language model, and a server communication interface. The client comprises four modules: a local private knowledge base, a local retrieval unit, a security processing unit, and a client communication interface.
[0111] The server-side communication interface receives natural language queries. The dynamic routing decision-maker performs semantic parsing and intent recognition on the received natural language queries, extracting key entities, domain keywords, and semantic features from the queries. Based on semantic parsing and intent recognition, the dynamic routing decision-maker also matches the semantic features of the queries with a predefined domain knowledge graph. According to the decision result, routing instructions are generated to determine one or more target clients. Semantic parsing and intent recognition are a coherent processing flow designed to extract structured information from user natural language queries in order to understand the query intent and determine the relevant domain.
[0112] The server-side communication interface is also used to execute routing instructions, distributing natural language queries in parallel to one or more target clients through a secure communication channel; the client-side communication interface is used to receive retrieval requests, the local retrieval unit is used to perform vector similarity calculation and keyword retrieval in a local private knowledge base to obtain an initial set of knowledge fragments, and the secure processing unit is used to process the initial set of knowledge fragments; the client-side communication interface is also used to return the processed intermediate results to the server-side communication interface; the federated aggregator is used to receive intermediate results from multiple client-side communication interfaces through the server-side communication interface, and to fuse the intermediate results to obtain an enhanced context document; the large language model module is used to receive the enhanced context document and the original query output by the federated aggregator; the large language model is used to receive the enhanced context document and the original query output by the federated aggregator; the large language model generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query; the server-side communication interface is also used to return the natural language answer generated by the large language model to complete a cross-domain question-and-answer interaction.
[0113] In this invention, the dynamic routing decision-maker uses a semantic analysis model and domain graph to determine one or more target clients to be invoked, thus achieving intelligent query routing. The dynamic routing decision-maker is the system's intelligent brain, responsible for analyzing query intent and determining the knowledge domain to be invoked. It includes a query parsing unit, a vectorization submodule, a domain matching unit, and a routing instruction generation unit. The query parsing unit receives natural language queries through a server-side communication interface. First, text preprocessing is performed, which involves removing illegal characters, standardizing encoding, and word segmentation. Then, a pre-trained Named Entity Recognition (NER) model is used to extract key entities from the query, and a domain-related keyword database is used to identify domain-specific terms. Simultaneously, a pre-trained semantic encoding model (such as Sentence-BERT) is used to convert the query text into a high-dimensional semantic vector. That is, query semantic vector , Used to capture deep semantic information and potential intent of queries; intent recognition is based on Intent classification model implementation, or through computation The similarity with the preset intent template vector is used to complete the process; the domain matching unit pre-sets a domain knowledge graph, in which each registered domain (such as cardiovascular disease diagnosis and treatment, financial analysis of listed companies) has a corresponding static domain description vector. , It is generated from authoritative descriptive texts in the field (such as diagnostic and treatment plans for diseases such as myocardial infarction and heart failure) through the same semantic encoding model.
[0114] In this invention, the federated aggregator serves as the system's knowledge fusion center, configured to receive and fuse secure processing results from multiple clients, generating a high-quality, coherent enhanced context through deduplication and reordering mechanisms. The federated aggregator consists of a result receiving buffer, a secure morphology conversion unit, a multi-scale deduplication module, a multi-factor reordering engine, and a context splicer. The result receiving buffer maintains a receiving buffer for each client connection and sets a timeout mechanism to ensure system robustness. For the ciphertext fragment C, the secure morphology conversion unit first calls the decryption interface of a homomorphic encryption library (such as TenSEAL) using the private key held by the system. The knowledge fragment M is decrypted and restored to its original form. For the condensed representation formed by knowledge distillation, the corresponding parsing model is invoked to restore it to a semantically complete textual expression.
[0115] In this invention, the parsing model is a trained neural network module whose function is to restore or generate a semantically complete and readable summary text from a low-dimensional semantic condensation representation for subsequent fusion processing. For example, the parsing model can be a conditional generation model that takes the condensation representation as input and outputs a corresponding text summary.
[0116] In this invention, the ciphertext fragment C returned by the i-th client i The initial knowledge fragment M obtained after decryption i Its expression is:
[0117] ;
[0118] sk is the key required for decryption. It is secretly held by the server and is never disclosed or passed to any client. Possessing the private key is the only prerequisite for performing decryption, ensuring system security; M i This is the output of the decryption function, i.e., the restored initial knowledge fragment. It recovers a readable text format so that the federated aggregator can perform subsequent semantic understanding, deduplication, and sorting; C i It is an encrypted knowledge fragment, or ciphertext fragment, sent back to the server from the i-th client, which hides the true content of the original information. This represents the decryption function corresponding to the encryption algorithm, which uses the private key sk to decrypt the ciphertext. Decryption is performed to recover the original knowledge fragments. In this invention, the large language model generates the final answer based on the enhanced context; the server-side communication interface is responsible for secure communication with the client.
[0119] The system of this invention requires at least two clients (client A, client B, ..., client N) deployed on different data participants. Each client includes: a local private knowledge base storing private, protected data in the domain; a local retrieval unit performing retrieval tasks in the local knowledge base; a security processing unit performing privacy protection processing such as encryption, desensitization, or distillation on the retrieval results; a client communication interface responsible for secure communication with the server; and a secure communication channel connecting the server and the client to ensure that all transmitted query requests and intermediate results are encrypted to prevent data from being stolen or tampered with during transmission.
[0120] The decision logic adopted by the dynamic routing decision-maker is as follows: the cosine similarity between the semantic vector of the query and the description vector of each domain is used as the matching score, and all domains with scores greater than a preset threshold are selected as target domains.
[0121] The secure processing unit employs a homomorphic encryption algorithm (such as the Paillier scheme), enabling the federated aggregator to perform certain fusion operations on ciphertext fragments without decryption. Its homomorphism is represented as:
[0122] ;
[0123] in, and These are the corresponding operations in the ciphertext and plaintext spaces, respectively; These represent the ciphertexts obtained by encrypting plaintexts a and b using the public key pk, respectively. and These are the encryption and decryption functions, respectively; pk and sk are the public and private keys, respectively. This indicates that the ciphertext is decrypted using the private key sk.
[0124] The federated aggregator uses a Transformer-based cross-encoder model to reorder the relevance of knowledge fragments from different clients.
[0125] By combining the above systems and methods, this invention technically achieves secure, efficient, and intelligent collaboration of cross-domain knowledge.
[0126] This invention, through the aforementioned system design, aims to achieve collaborative utilization of cross-domain knowledge without requiring participating parties to centralize their private data, breaking down data silos and resolving data privacy and compliance issues. Simultaneously, it enhances cross-domain cognition and decision-making capabilities. Through effective federated retrieval and knowledge fusion mechanisms, large models can comprehensively utilize professional knowledge from multiple heterogeneous domains to generate in-depth, accurate, and coherent cross-domain answers. Furthermore, it achieves intelligent querying and resource scheduling, introducing a decision-making mechanism to automatically identify the user's query intent and related domains, intelligently scheduling the most suitable domain knowledge base for computation. Finally, it constructs a secure and reliable collaborative framework system to ensure that the entire system meets privacy protection and secure computation requirements throughout the entire process of retrieval, transmission, fusion, and generation.
[0127] In this embodiment of the invention, the federated RAG is a privacy-preserving distributed retrieval enhancement generation architecture. Its core feature lies in deconstructing the traditional centralized knowledge base into multiple distributed private knowledge bases and achieving cross-domain knowledge collaboration through secure computing protocols. Under this architecture, the original data of each participant remains local, and only anonymized intermediate results are provided to the central server through technologies such as encrypted retrieval and knowledge distillation. Ultimately, while ensuring data compliance, the retrieval, fusion, and generation of cross-domain knowledge are completed. This technology is a key path to solving data silos and privacy barriers, and is suitable for cross-institutional collaboration scenarios with stringent data security requirements, such as finance and healthcare. The federated aggregator, deployed as the core processing module on the server side, is responsible for fusing and enhancing heterogeneous, securely processed knowledge fragments from multiple clients. Its working mechanism typically includes multi-stage pipeline processing: first, the encrypted or distilled intermediate results are decrypted and parsed; then, multi-scale deduplication is performed based on text fingerprints and semantic vectors; subsequently, multiple factors such as relevance, source credibility, and content novelty are combined for weighted sorting; and finally, a high-quality enhanced context is generated by concatenating these factors. This module is crucial for transforming multi-source information into unified knowledge, directly determining the accuracy and information density of the system's generated answers. The Large Language Model (LLA) is a generative AI model based on the Transformer architecture, pre-trained on massive amounts of text data, possessing powerful natural language understanding and generation capabilities. In this system, this model serves as the final answer generator, taking as input the structured context enhanced by the federated aggregator and the original user query, and outputting professional, accurate, and coherent natural language answers through autoregressive generation. Its role is to perform deep reasoning and integration of retrieved knowledge fragments with question semantics, achieving a leap from information retrieval to intelligent question answering. Homomorphic encryption is a cryptographic technique that supports direct arithmetic or logical operations in ciphertext. In this system, this algorithm is used by the client to encrypt the search results, enabling the federated aggregator to perform preliminary fusion operations (such as filtering and counting) on the ciphertext fragments without decryption, providing the highest level of privacy protection for data usability without visibility. The knowledge fusion mechanism refers to a systematic method for integrating, disambiguating, and unifying knowledge fragments from heterogeneous, distributed data sources within the federated RAG framework. This mechanism not only includes routine processing of plaintext, but also needs to handle inputs with various security forms such as encryption, desensitization, and distillation. Its typical process includes security form conversion, semantic-based redundancy elimination, multi-dimensional quality assessment, and context reconstruction. It aims to eliminate information conflicts and redundancy, extract core semantics, and construct a coherent knowledge background to support complex reasoning. It is the core processing logic for improving the depth and reliability of cross-domain question answering.
[0128] In embodiments of the present invention, such as Figure 2As shown, the system architecture is based on a server-client federated design, making full use of data resources from different fields to perform distributed retrieval and generation tasks. It aims to achieve secure collaboration of cross-domain knowledge while ensuring a high level of data privacy protection.
[0129] The core process of the federated RAG system includes five main stages: query parsing, dynamic routing, distributed retrieval, secure fusion, and intelligent generation. In the query parsing stage, the input natural language query undergoes semantic analysis and intent recognition to extract key entities and domain features. In the dynamic routing stage, the system determines relevant target domains based on semantic similarity calculations. In the distributed retrieval stage, clients from different domains retrieve relevant information in parallel from their local knowledge bases. In the secure fusion stage, the federated aggregator performs privacy-preserving fusion processing on the results from multiple sources. In the answer generation stage, the large language model receives enhanced context and the original query to generate the final answer. This process achieves a leap from single-point question answering to a closed-loop complex decision chain.
[0130] At the server-side architecture level: a hybrid architecture strategy of centralized coordination and distributed processing is adopted. Based on centralized coordination, the decision-maker, federated aggregator, and large language model modules work collaboratively, with data and control flows transmitted between modules via a service bus. User queries are dynamically routed to different clients based on semantic features and domain relevance, achieving intelligent query distribution. Centralized coordination effectively ensures overall system consistency and scheduling efficiency, achieving precise cross-domain knowledge scheduling through fine-grained routing decisions. Based on distributed processing, a federated learning network is formed between the server and multiple clients, and distributed processing units are established between the server and medical, financial, and industrial clients. Knowledge retrieval tasks are distributed to clients in various domains, with each client handling corresponding retrieval tasks based on its own data characteristics and security requirements. During query processing, data flows sequentially through server-side routing, client-side retrieval, and server-side fusion, with each client handling corresponding retrieval tasks based on its own domain characteristics. Between different clients, securely processed knowledge fragments are transmitted to the server via encrypted channels. During answer generation, enhanced contextual information is uniformly processed by the large language model to generate the final answer.
[0131] At the client-side architecture level: To address the privacy protection needs of data across different domains, a hybrid security strategy based on homomorphic encryption and knowledge distillation is adopted. In the federated RAG design, for highly sensitive data domains (such as medical records and financial transaction records), the client uses homomorphic encryption to encrypt the search results, forming ciphertext fragments. For scenarios with high real-time requirements, the client uses knowledge distillation to compress the original knowledge into semantic vectors. Within each client, the data processing flow includes three steps: local retrieval, secure processing, and result return. Different security processing strategies exist across clients. Depending on the data type and privacy level requirements, the client employs different combinations of security processing, including homomorphic encryption, data anonymization, and knowledge distillation. Compared to the traditional centralized RAG architecture, the federated design effectively reduces the risk of data leakage, thus effectively balancing the conflict between knowledge utilization and privacy protection.
[0132] The federated RAG system in this invention employs a dynamic routing strategy based on semantic vector similarity, effectively alleviating the matching contradiction between cross-domain queries and specialized knowledge bases. However, this routing method still has problems with complex cross-domain queries. First, routing accuracy is affected by the quality of the domain description vectors. For example, when the domain description is not accurate enough, similarity calculation may be biased, leading to the incorrect identification of relevant domains and unsatisfactory query results. Second, in traditional semantic matching algorithms, the same similarity threshold is used for all domains, which may lead to misjudgments for highly specialized domains, further exacerbating the problem of incomplete knowledge coverage in cross-domain queries and significantly increasing unnecessary computational overhead.
[0133] In embodiments of the present invention, such as Figure 1 As shown, the dynamic routing decision mechanism includes:
[0134] To address the new challenges introduced by traditional semantic matching in cross-domain environments, the decision-maker employs an optimization strategy called Multi-level Dynamic Routing Decision (MDRD). The core of the MDRD strategy lies in achieving refined and intelligent routing decisions through two collaborative decision-making levels. First, by introducing a domain-specific threshold adjustment mechanism, different domains set different similarity thresholds based on their specialization and data sensitivity: a higher threshold (0.8) for the medical domain, a medium threshold (0.75) for the financial domain, and a relatively lower threshold (0.7) for the industrial domain, thus more accurately matching query intent. Second, addressing the specific challenges posed by query complexity—that a single threshold is insufficient to meet the needs of multi-domain collaboration as the number of domains involved in the query increases—the second level of the MDRD strategy—the query complexity assessment module—is activated. This module dynamically adjusts the strictness of the routing strategy based on the number of entities identified and the number of domain keywords in the query. In other words, for a highly complex cross-domain query, even if its similarity to a certain professional domain is slightly below the preset threshold, the system may still include it in the routing scope due to its high complexity, ensuring the completeness and depth of the generated answer.
[0135] In this embodiment of the invention, taking a cross-domain query between healthcare and finance as an example, the query analysis of the impact of a cardiovascular drug's launch on the stock price of a pharmaceutical company includes two key entities: the cardiovascular drug and the pharmaceutical company's stock price. The system identifies that it involves two domains: healthcare and finance. During routing decisions, the MDRD strategy works in parallel: calculating the similarity with the healthcare and finance domains separately, and simultaneously evaluating the complexity of the query. Since the query contains explicit entities from two different domains, its complexity is high. Therefore, when the similarity between the two domains exceeds their respective thresholds (healthcare > 0.8, finance > 0.75), the system will route to both the healthcare client and the finance client simultaneously.
[0136] In this embodiment of the invention, cosine similarity calculation is a basic operation of the MDRD strategy, used to measure the semantic relevance between the query vector and the domain vector. It is used in the dynamic routing decision process to evaluate the relevance of the query to each domain and to perform accurate routing.
[0137] To address the issue of domain concept drift caused by the fixed domain description vectors used in the MDRD strategy over time, an adaptive domain vector adjustment mechanism is created based on domain knowledge updates to achieve dynamic optimization. A periodic domain vector update strategy is employed, periodically re-encoding the domain description text to ensure that the domain vectors reflect the latest domain knowledge developments without introducing conceptual lag. From an algorithmic perspective, adaptive updating is equivalent to a standard online learning mechanism, thus guaranteeing the decision-making accuracy and long-term timeliness of the MDRD strategy.
[0138] In embodiments of the present invention, such as Figure 1 As shown, the secure fusion mechanism of the federated aggregator includes:
[0139] In the design of federated RAGs, if the intermediate result returned by the client is homomorphically encrypted, a decryption-then-fusion processing flow is adopted, such as... Figure 1 As shown, the encrypted fragment is first decrypted in the federated aggregator to restore the plaintext knowledge fragment. Since different clients may employ different security processing strategies, the federated aggregator needs to support inputs with various security profiles. This approach ensures consistency in the processing flow and is suitable for the fusion of multiple security processing strategies. If the intermediate result returned by the client is a semantic vector after knowledge distillation, a vector space fusion strategy is used to weight and combine multiple semantic vectors in a vector space to preserve the semantic information of the original knowledge. Using a traditional single fusion method can easily lead to information loss or poor fusion results. Figure 2 As shown, in order to achieve the fusion of multi-source knowledge while protecting privacy, three knowledge fusion modes are designed:
[0140] For scenarios where multiple clients return encrypted fragments, a fusion mode of Secure Decryption and Multi-scale Deduplication (SD-MDD) is designed. Each encrypted fragment is first decrypted using the private key sk in the federated aggregator to restore it to a plaintext knowledge fragment. To ensure the efficiency of the fusion effect, a multi-scale deduplication mechanism is designed in the federated aggregator. This mechanism uses SimHash fingerprints and semantic similarity calculations to identify and remove redundant knowledge, thereby reducing information redundancy and memory overhead in the context.
[0141] For scenarios where multiple clients return distilled vectors, a fusion model of Semantic Reconstruction and Knowledge Enhancement (SR-KE) is designed. When the federated aggregator receives a distilled vector, it first uses a parsing model (or semantic expander) to restore the vector to a generalized text. Then, it performs correlation analysis and information complementation on multiple generalized texts in the semantic space, finally reconstructing knowledge content with higher information density. The parsing model is a trained neural network module whose function is to restore or generate a semantically complete and readable generalized text representation from a low-dimensional semantic condensation representation for subsequent fusion processing. For example, this parsing model can be a conditional generation model that takes the condensation representation as input and outputs the corresponding text summary.
[0142] For scenarios with hybrid security processing strategies, a fusion mode of a unified knowledge fusion framework is designed. The federated aggregator supports multiple input formats, including ciphertext, desensitized text, and distilled vectors. Through unified knowledge representation and fusion algorithms, it achieves collaborative knowledge enhancement under heterogeneous security paradigms.
[0143] In this embodiment of the invention, based on technical indicators and logical deduction, the expected operating results of the method of the present invention in three core dimensions—privacy security and compliance, question-answering quality, and system efficiency—were simulated. All data are simulated / theoretical calculation values, aiming to demonstrate the expected performance improvement of the present invention compared to baseline methods (centralized RAG, unroute federated retrieval).
[0144] 1. Test environment and benchmark settings (simulation);
[0145] Simulated scenario: A federal RAG system containing clients from 5 domains (healthcare, finance, law, industry, and government).
[0146] Baseline comparison methods: Baseline 1: Centralized RAG, assuming all data can be centralized as the ideal performance ceiling (but often cannot be achieved in reality due to privacy issues); Baseline 2: Unrouted federated retrieval, the query is broadcast to all 5 clients.
[0147] Evaluation metrics; Privacy and security: theoretical assessment based on the security strength of the encryption technology used.
[0148] Overall score of the answer: Simulated value. By designing 10 complex cross-domain queries, the review experts scored the answer on a 5-point scale (simulated average) based on its professionalism, completeness, and logic.
[0149] End-to-end latency for a single query: a theoretical estimate, mainly considering communication and retrieval overhead.
[0150] 2. The core operating results (simulation data) are shown in Tables 1, 2 and 3;
[0151] Table 1 Comparison of Privacy Security and Compliance
[0152] ;
[0153] Table 2. Results of Cross-Domain Question Answering Quality Simulation Evaluation
[0154] ;
[0155] As shown in Table 2, the overall score is close to the theoretical upper limit and is significantly better than the no-routing federated solution.
[0156] Table 3 Theoretical Analysis of System Efficiency
[0157] ;
[0158] 3. Core Conclusions (Simulation Verification);
[0159] Privacy, Security, and Compliance: This invention's method, through a federated architecture and homomorphic encryption, theoretically reduces the risk of privacy breaches to a cryptographically secure level, overcoming the compliance barriers of centralized RAGs. Question-Answer Quality: Through dynamic routing and multi-source fusion, simulation evaluation shows that its overall answer quality (3.93) is significantly higher than that of the non-routable federated scheme (2.80), and approaches the theoretical upper limit under centralized data conditions (4.23). System Efficiency: Intelligent routing is expected to reduce unnecessary communication and computational overhead by approximately 52%, improving system responsiveness and scalability.
[0160] The technical solution provided by this invention includes constructing a federated RAG system architecture; optimizing the dynamic routing decision mechanism based on the constructed system architecture; and designing a secure and integrated knowledge enhancement mechanism based on the optimized routing strategy. This method fully utilizes the privacy protection features of federated learning, improves the cross-domain knowledge collaboration effect, and optimizes the quality of knowledge fusion.
[0161] Compared with the prior art, the present invention has the following advantages:
[0162] I. This invention fundamentally solves the challenges of data privacy and compliance. Through a federated architecture, it achieves a paradigm shift where data remains stationary while knowledge flows freely. Each participating party's private data does not need to leave their local machine; after local retrieval and security processing, encrypted, anonymized, or distilled intermediate results are provided to the server. This mechanism completely avoids the risk of sensitive data leakage during transmission and centralization, enabling the system to legally and compliantly utilize high-value information from data silos distributed across highly sensitive fields such as healthcare and finance.
[0163] II. This invention achieves deep collaboration and cognitive leap across domains, breaking down the knowledge boundaries of a single model or knowledge base through a decision-maker and federated aggregation mechanism. The system can intelligently identify multiple domains involved in a user query and retrieve the most relevant professional knowledge fragments from clients in each domain in parallel, fusing them to form a globally enhanced context. This enables the large language model to perform deep cross-domain reasoning and knowledge association, generating answers with both breadth and depth, achieving a leap from single-point question answering focused on a single fact to a closed-loop decision chain for solving complex problems;
[0164] III. This invention improves the system's intelligence, efficiency, and resource utilization. The introduced decision-maker accurately identifies intent and relevant domains based on query semantics, avoiding blind searches and wasted computational resources in traditional cross-domain retrieval. This intelligent scheduling ensures the efficiency and targeting of retrieval actions, improving cross-domain retrieval accuracy while reducing the overall communication and computational overhead of the system, achieving efficient matching of computing resources and task requirements.
[0165] IV. This invention constructs a flexible, scalable, secure, and trustworthy collaborative framework. This system architecture possesses excellent modularity and scalability. New domain participants can easily join the system as plug-ins; simply deploying a standard client and completing server registration allows for rapid expansion of the federated knowledge network. This flexibility, combined with end-to-end privacy protection design (retrieval, transmission, fusion, and generation), lays a solid technical foundation for building a large-scale, secure, and trustworthy AI collaborative ecosystem among multiple distrustful participants.
[0166] V. This invention effectively balances answer quality and generation efficiency. Through a multi-level result fusion strategy, particularly considering relevance, source credibility, and content novelty in the ranking stage, it ensures that the contextual information input to the large model possesses both high quality and high information density. This not only directly improves the accuracy, professionalism, and fault tolerance of the final generated answer but also reduces the reasoning burden of the large model generation stage by providing precise context. Thus, while ensuring high-quality answers, it maintains the overall response efficiency of the system, providing reliable technical support for the large-scale application of large models.
[0167] The technical solution provided by this invention includes a method for query reception and parsing. The server performs semantic parsing and intent recognition on the received natural language query, extracting key entities, domain keywords, and semantic features from the query. Target clients are determined; based on semantic parsing and intent recognition, the server matches the semantic features of the query with a predefined domain knowledge graph. Based on the decision result, routing instructions are generated to determine one or more target clients. Federated retrieval request distribution occurs; the server executes the routing instructions, distributing the natural language query in parallel to one or more target clients through a secure communication channel. Local retrieval and secure processing occur; the client receives the retrieval request, performs vector similarity calculation and keyword retrieval to obtain an initial set of knowledge fragments, and processes them. The processed intermediate results are returned to the server. Multi-source result fusion occurs; the server receives intermediate results from multiple clients and fuses them to obtain an enhanced context document. Answer generation occurs; the server generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query. Result return occurs; the natural language answer is returned to the server to complete a cross-domain question-and-answer interaction. This method achieves effective cross-domain knowledge collaboration.
[0168] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A cross-domain large model method based on federated RAG, characterized in that, The method includes: Step 1: Query Reception and Parsing. The server performs semantic parsing and intent recognition on the received natural language query, extracting key entities, domain keywords, and semantic features from the query. Intent recognition is achieved through a classification method, which involves training an intent classifier to map queries to predefined intent categories. The intent category, key entities extracted from the query, domain keywords, and semantic features together serve as a comprehensive basis for dynamic routing decisions. Step 2: Identify target clients. Based on semantic parsing and intent recognition, the server matches the semantic features of the query with a predefined domain knowledge graph. Based on the decision result, routing instructions are generated to identify one or more target clients. Dynamic routing decision-making is a multi-level dynamic routing decision-making process. The core of multi-level dynamic routing decision-making lies in two collaborative decision-making levels. First, by introducing a domain-specific threshold adjustment mechanism, different domains set different similarity thresholds based on their specialization and data sensitivity. Second, a query complexity evaluation module is enabled, which dynamically adjusts the strictness of the routing strategy based on the number of entities identified in the query and the number of domain keywords. Cosine similarity calculation is used in multi-level dynamic routing decision-making to measure the semantic relevance between the query vector and the domain description vector. An adaptive domain description vector adjustment mechanism is created based on domain knowledge updates. A periodic domain description vector update strategy is adopted, by periodically re-encoding the domain description text to ensure that the domain description vector reflects the latest developments in domain knowledge. Step 3: Federated search request distribution. The server executes routing instructions to distribute natural language queries in parallel to one or more target clients through a secure communication channel. Step 4: Local retrieval and security processing. The client receives the retrieval request, performs vector similarity calculation and keyword retrieval, obtains an initial set of knowledge fragments, processes them, and returns the processed intermediate results to the server. Step 5: Multi-source result fusion. The server receives intermediate results from multiple clients and fuses them to obtain an enhanced context document. Step 6: Generate the answer. The server generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query. Step 7: Return the result. Return the natural language answer to the server to complete a cross-domain question-and-answer interaction.
2. The method according to claim 1, characterized in that, Step 1 includes: First, text preprocessing is performed to clean the input query text, including removing irrelevant characters, standardizing the encoding format, and performing word segmentation. Next, key entity and domain keyword extraction is performed. A pre-trained natural language processing model is used to extract key entities from the query. Simultaneously, a domain keyword dictionary or TF-IDF statistical method is used to identify terms highly relevant to the predefined domain. Then, semantic feature extraction and intent recognition are performed. The pre-processed query text is input into a pre-trained semantic encoding model, which converts the query into a high-dimensional dense vector, i.e., the query semantic vector. The query semantic vector contains the semantic information of the query; intent recognition is achieved through a classification method, which involves training an intent classifier to map queries to predefined intent categories; the intent classifier is a machine learning model trained under supervised learning, and the intent classifier uses the query semantic vector generated by the semantic encoding model. As input features, they are processed by a fully connected neural network classification layer, and finally the output layer obtains the probability distribution of each predefined intent category. The intent classifier is obtained by training the model using historical query data with labeled intent categories. The intent categories it identifies, together with the key entities, domain keywords and semantic features extracted from the query, serve as a comprehensive basis for dynamic routing decisions.
3. The method according to claim 2, characterized in that, Step 2 includes: By calculating the query semantic vector With each domain description vector Cosine similarity, as a matching score The calculation formula is as follows: ; in, This represents the description vector of the i-th domain; Based on the matching score, determine one or more target domains related to the current query; based on the decision result, generate routing instructions to identify one or more target clients.
4. The method according to claim 3, characterized in that, Step 4 includes: The initial knowledge fragment is encrypted using a homomorphic encryption algorithm to form a ciphertext fragment. The formal representation of the encryption process is as follows: ; Where M represents the initial knowledge fragment. C is the public key, C is the ciphertext fragment; Enc represents the encryption function of the homomorphic encryption algorithm; Sensitive entities in the initial knowledge fragments are desensitized to generate non-sensitive text; Knowledge distillation technology is used to compress initial knowledge fragments into condensed representations that retain core semantics.
5. The method according to claim 4, characterized in that, Step 5 includes: a. Decryption and parsing; If the intermediate result is ciphertext or distilled representation, then decryption or parsing to restore it is performed first. The decryption process is as follows: ; in, C represents the private key; C represents the ciphertext fragment; Dec represents the mathematical operation process used to receive the private key. Using the ciphertext fragment C as input, the previous encryption process is reversed through a cryptographic algorithm; b. Deduplication; Based on text fingerprints or semantic similarity, remove duplicate knowledge fragments; c. Sorting; based on relevance scores to the original query. Source, client credibility weight and the novelty of knowledge fragments All knowledge fragments are comprehensively re-ranked; the final ranking score for each knowledge fragment is... Calculated using the following weighted formula: ; in, These are adjustable weighting coefficients used to balance the importance of different ranking factors, and Its value is determined through empirical setting or optimization on a validation set; The sorting process is the core step in multi-source result fusion processing, aiming to filter and integrate complementary knowledge. Its configuration methods include the following: Experience setting: determined based on the experience of domain experts or preliminary experiments; Optimization learning: On small-scale labeled datasets, with the quality of the final answer as the optimization objective, the optimal weight combination is learned through grid search, Bayesian optimization or gradient descent methods. d. Collage; Collage the top-ranked knowledge fragments into a unified, enhanced contextual document; Correlation score The semantic relevance score between the fragment and the query is generated during client-side retrieval or recalculated by the server-side cross-encoder model. Specifically, during local client-side retrieval, an initial relevance score is generated for each retrieved knowledge fragment to characterize its relevance to the query through vector similarity calculation or retrieval model. The initial relevance score is returned to the server along with intermediate results or obtained by the server-side cross-encoder model re-scoring the knowledge fragment and the query. Credibility weight To evaluate client-based static or dynamic values, initial weights are pre-set based on factors such as client authority, quality of historical responses, and data update frequency, and are dynamically adjusted based on feedback from historical interactions. Novelty This is used to measure the degree of information addition of the current fragment relative to the considered fragments, and to measure whether the information provided by the knowledge fragment is repetitive or complementary to other selected fragments; it is determined by calculating the semantic similarity between the current fragment and the top-ranked fragments, or by detecting whether it contains new entities or relationships. Its expression is: = 1-max(similarity(current segment, selected segment)), where max represents the maximum value function.
6. The method according to claim 5, characterized in that, Step 6 includes: The goal of the natural language answer generation process is to maximize the generated answer sequence Y in a given enhanced context document. Given the probability under query Q, this process is formalized as maximizing the log-likelihood of the generated answer sequence Y, expressed as: ; in, This represents the t-th word in the sequence of generated answers; Indicates in generation All previously generated word sequences, excluding t; Indicates in a given enhanced context Query Q and the currently generated partial answer sequence Under the condition that the model predicts the next word as The conditional probability.
7. A cross-domain large model system based on federated RAG, characterized in that, The system is used to implement the cross-domain large model method based on federated RAG as described in claim 1, and the system includes: The system consists of a server and a client. The server comprises four modules: a dynamic routing decision-maker, a federated aggregator, a large language model, and a server communication interface. The client comprises four modules: a local private knowledge base, a local retrieval unit, a security processing unit, and a client communication interface. The server-side communication interface is used to receive natural language queries, and the dynamic routing decision-maker is used to perform semantic parsing and intent recognition on the received natural language queries, extracting key entities, domain keywords and semantic features from the queries; Based on semantic parsing and intent recognition, the dynamic routing decision-maker is also used to match the semantic features of the query with a predefined domain knowledge graph; based on the decision result, it generates routing instructions and identifies one or more target clients; The server-side communication interface is also used to execute routing instructions, distributing natural language queries in parallel to one or more target clients through a secure communication channel; The client communication interface is used to receive search requests, the local searcher is used to perform vector similarity calculation and keyword search in the local private knowledge base to obtain an initial set of knowledge fragments, and the security processing unit is used to process the initial set of knowledge fragments; the client communication interface is also used to return the processed intermediate results to the server communication interface. The federated aggregator is used to receive intermediate results from multiple client communication interfaces through the server-side communication interface, and to merge the intermediate results to obtain an enhanced context document. The large language model is used to receive the enhanced context document output by the federated aggregator and the original query; the large language model generates a natural language answer by performing semantic parsing and context-aware reasoning on the enhanced context document and the original query; The server-side communication interface is also used to return natural language answers generated by the large language model to complete a cross-domain question-and-answer interaction.
8. The system according to claim 7, characterized in that, The dynamic routing decision-maker includes a query parsing unit, a vectorization submodule, a domain matching unit, and a routing instruction generation unit; The query parsing unit receives natural language queries through the server communication interface. First, text preprocessing is performed, which involves removing illegal characters, standardizing encoding, and word segmentation. Subsequently, a pre-trained Named Entity Recognition (NER) model is used to extract key entities from the query, and a domain keyword database is combined to identify domain-related terms. Simultaneously, a pre-trained semantic encoding model is used to convert the query text into a high-dimensional semantic vector. That is, query semantic vector , Used to capture deep semantic information and potential intent of queries; Intent recognition is based on Intent classification model implementation, or through computation The similarity with the preset intent template vector is used to complete the process; the domain matching unit pre-sets a domain knowledge graph, in which each registered domain has a corresponding static domain description vector. , It is generated from authoritative descriptive texts in the domain using the same semantic encoding model.
9. The system according to claim 8, characterized in that, The federated aggregator consists of a result receiving buffer pool, a secure form conversion unit, a multi-scale deduplication module, a multi-factor reordering engine, and a context splicer; the result receiving buffer pool maintains a receiving buffer for each client connection and sets a timeout mechanism. The secure morphological conversion unit first calls the decryption interface of the homomorphic encryption library for the ciphertext fragment C, using the private key held by the system. The knowledge fragment M is decrypted and restored to its original form. For the condensed representation formed by knowledge distillation, the corresponding parsing model is invoked to restore it to a semantically complete textual representation. The parsing model is a trained neural network module whose function is to restore or generate a semantically complete and readable summary textual representation from the low-dimensional semantic condensed representation for subsequent fusion processing.
Citation Information
Patent Citations
Multi-knowledge-base scheduling routing method based on intention recognition and feedback optimization
CN120973866A
Big-model multi-client collaborative positioning knowledge editing method based on federal learning
CN120996149A