Retrieval enhancement generation method and system based on privacy content shielding and segmentation reasoning

By deploying the embedding layer and output layer of a large language model on the edge and combining it with a privacy-enhanced knowledge base, the problems of privacy protection and reasoning efficiency in retrieval-enhanced generation technology are solved, achieving efficient and secure privacy protection and result accuracy.

CN120632080APending Publication Date: 2025-09-12JIANGSU SECOND NORMAL UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510849957.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Existing retrieval-enhanced generation technologies have shortcomings in privacy protection and reasoning efficiency, especially in the cloud deployment of large language models, which face privacy leakage risks and resource bottlenecks. At the same time, traditional privacy protection methods affect the utility of the results.

Method used

Using the model segmentation reasoning and privacy-enhanced knowledge base method, the embedding layer and output layer of the large language model are deployed on the edge, and the middle layer is deployed on the cloud. Combined with privacy masking and segmentation reasoning technology, user input and results are processed on the edge to build a three-layer privacy-enhanced knowledge base to achieve privacy protection and efficient reasoning.

Benefits of technology

It enables local processing of user input and results, eliminates plaintext leakage in the cloud, reduces the risk of privacy leakage, improves reasoning efficiency and generation quality, and is suitable for a variety of privacy-sensitive scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632080A_ABST
    Figure CN120632080A_ABST
Patent Text Reader

Abstract

The invention discloses a retrieval enhancement generation method and system based on privacy content shielding and segmentation reasoning, and the system divides a large language model into an embedded layer and an output layer which are deployed at an edge end, and a middle layer which is deployed at a cloud end, thereby guaranteeing that a natural language problem input by a user and a plaintext of a reasoning result are only processed locally, and improving the efficiency of retrieval. The cloud plaintext leakage risk is prevented; meanwhile, a three-layer privacy enhancement knowledge base is constructed, original knowledge is dynamically shielded through a privacy shielding module in an offline stage, and a privacy mapping table of privacy content and shielded content is generated. The system completely eradicates all threats from the cloud and aiming at plaintext attacks in the communication process through segmentation reasoning, and the privacy leakage risk when the system is attacked by ciphertext tensor is greatly reduced by using the privacy enhancement knowledge base. The system gives consideration to privacy, low time delay and high availability of a retrieval enhancement generation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a retrieval enhancement generation method and system based on privacy content masking and segmentation reasoning. Background Art

[0002] With the development of artificial intelligence (AI), large-scale language models such as the GPT series have achieved significant breakthroughs in natural language processing. Their powerful text generation and semantic understanding capabilities provide strong support for a wide range of application scenarios. Retrieval-Augmented Generation (RAG) technology, in particular, combines the retrieval capabilities of external knowledge bases with the generation capabilities of language models, demonstrating tremendous potential in areas such as question-answering systems, intelligent customer service, and medical decision support. However, the practical application of these technologies still faces a number of challenges, particularly in terms of privacy protection and inference efficiency.

[0003] In recent years, large-scale language models such as the GPT series have demonstrated remarkable capabilities in natural language processing, particularly in text generation and semantic understanding. These models have opened up new possibilities for scenarios such as question-answering systems, document generation, and intelligent interaction. However, the practical application of these technologies faces significant challenges, particularly in terms of privacy protection and inference efficiency.

[0004] Retrieval-Augmented Generation (RAG) technology combines language models with knowledge bases, retrieving relevant knowledge to improve the accuracy and diversity of generated content. For RAG applications, such as large industry models and enterprise-specific models, knowledge bases often contain private information of enterprises and individuals, including but not limited to trade secrets. This places higher demands on data privacy and security. In traditional large-model cloud-based deployment architectures, user questions and knowledge base content must be uploaded to the cloud. This approach can leak user questions and knowledge base content to untrusted clouds and attackers from the cloud. Although technologies such as multi-party secure computation, homomorphic encryption, and differential privacy can theoretically provide some privacy protection, these methods generally suffer from computational complexity, low efficiency, and limited applicability, making them difficult to scale in practical applications. Furthermore, the performance of RAG systems relies heavily on the reasoning capabilities of large-scale language models, which often have billions or even hundreds of billions of parameters. Running them entirely on edge devices can face resource bottlenecks, while relying solely on cloud-based inference poses the risk of privacy leakage.

[0005] Split inference technology alleviates this problem to a certain extent by processing the calculations of the plaintext-related layer locally, eliminating attacks on plaintext. However, this method cannot effectively deal with attacks on ciphertext tensors. When the attacker comes from other companies that share the model, when the open source model is deployed, or when the model file is leaked, the system will face threats such as embedding reversal attacks and stealing cloud output to continue inference.

[0006] Furthermore, traditional privacy protection methods, such as sensitive content masking, can completely lose key information while masking sensitive information, thus affecting the usability of the results. Therefore, improving inference efficiency and generation quality while protecting user privacy has become a pressing issue in the design of retrieval-enhanced generation systems. Summary of the Invention

[0007] The purpose of the present invention is to provide a retrieval enhancement generation method and system based on privacy content masking and segmentation reasoning, so as to solve the problems of insufficient privacy in retrieval enhancement generation technology, loss of timeliness and loss of result utility caused by privacy protection.

[0008] To achieve the above objectives, the present invention provides a retrieval enhancement generation method based on privacy content masking and segmentation reasoning, which includes two stages: offline and online; wherein,

[0009] The offline phase includes the following steps:

[0010] S1.1. The user cleans and segments the original knowledge document to generate structured knowledge fragments. Each knowledge fragment is converted into a corresponding knowledge vector using an embedding model and stored in the original knowledge layer of the privacy-preserving knowledge base.

[0011] S1.2. The user terminal masks the private content in each knowledge segment to generate a privacy-masked knowledge segment, which is stored in the privacy-masked knowledge layer of the privacy-preserving knowledge base.

[0012] S1.3. The user generates a privacy mapping table for the knowledge fragment and stores it in the privacy mapping table layer of the privacy-preserving knowledge base.

[0013] S1.4. Split the large language model into an embedding layer, an intermediate layer, and an output layer. The embedding layer and the output layer are deployed in the edge subsystem, and the intermediate layer is deployed in the cloud subsystem. The edge subsystem also deploys the embedding model and the privacy-preserving knowledge base.

[0014] The online phase consists of the following steps:

[0015] S2.1. The edge terminal system authenticates the user terminal, and the cloud subsystem authenticates the edge terminal system. After authentication, the natural language question entered by the user is transmitted from the user terminal to the edge terminal system.

[0016] S2.2. Use the embedding model to convert the user's natural language question into a corresponding input vector, and match it with the k most similar knowledge fragments in the original knowledge layer of the privacy-preserving knowledge base;

[0017] S2.3. Based on the privacy mapping table corresponding to the k knowledge fragments with the highest similarity to the input vector in the privacy-preserving knowledge base, mask the private content in the natural language question input by the user to generate a privacy-masked input. This input is then used as the question, and the privacy-masked knowledge fragments corresponding to the matched knowledge fragments in the privacy-preserving knowledge base are concatenated as reference knowledge to construct a prompt.

[0018] S2.4, the embedding layer of the large language model converts the prompt into a corresponding embedding vector and uploads it to the cloud subsystem;

[0019] S2.5. After the cloud subsystem performs the middle-layer inference of the large language model, it returns the hidden state vector to the edge subsystem.

[0020] S2.6, the edge terminal system generates a preliminary answer based on the received hidden state vector through the output layer of the large language model;

[0021] S2.7. Based on the privacy mapping table, the masked content in the preliminary answer is restored to the private content, and the final answer is generated and returned to the user end.

[0022] The present invention also provides a search enhancement generation system based on the above method, the system comprising a user terminal, an edge subsystem, and a cloud subsystem, wherein:

[0023] The user end includes an interactive module and a privacy shielding module:

[0024] The interactive module is used to receive natural language questions input by users and return the final answer;

[0025] The privacy masking module is used to construct privacy masking knowledge fragments in the privacy protection knowledge base of the edge subsystem;

[0026] The edge terminal system includes an embedding model, the embedding layer and output layer of the large language model, a privacy-preserving knowledge base, and a RAG interaction module:

[0027] The embedding model is used to convert knowledge fragments and natural language questions input by users into vector representations to obtain knowledge vectors and input vectors;

[0028] The embedding layer of the large language model is used to convert the prompt into the corresponding embedding vector;

[0029] The output layer of the large language model is used to receive the hidden state vector and generate a preliminary answer;

[0030] The privacy-preserving knowledge base is divided into the original knowledge layer, the privacy-masking knowledge layer, and the privacy mapping table layer, which respectively store knowledge vectors, privacy-masking knowledge fragments, and privacy mapping tables;

[0031] The RAG interaction module is used to construct prompts and restore the masked content in the preliminary answer to private content to generate the final answer;

[0032] The cloud subsystem includes the middle layer of the large language model, which is used to receive prompts, generate hidden state vectors and return them to the edge subsystem.

[0033] Therefore, the present invention adopts the above-mentioned retrieval enhancement generation system and method based on model segmentation reasoning and privacy enhancement knowledge base, which has the following beneficial effects:

[0034] (1) The embedding layer and output layer of the large language model are deployed in the edge subsystem, and the middle layer is deployed in the cloud subsystem, which realizes the split reasoning of the model and offloads the main computing load to the cloud. This ensures that the natural language questions input by users and the plaintext of the reasoning results are only processed locally, eliminating all attacks on the plaintext from untrusted clouds;

[0035] (2) The system supports multiple enterprises or organizations to deploy their own edge terminal systems, realizing the sharing of cloud models;

[0036] (3) The system is based on access control, ensuring that different users can only see the knowledge content within their authority, reducing the risk of privacy leakage from within the enterprise, making the system more suitable for various application scenarios;

[0037] (4) When the system encounters an attacker from a company or organization that shares the model, deploys an open source model, or the model file is leaked, the privacy protection knowledge base will greatly reduce the risk of privacy leakage when the system is attacked by the ciphertext tensor, and the attacker can only obtain the content information after the privacy is masked;

[0038] (5) Compared with traditional privacy protection methods such as homomorphic encryption and multi-party secure computation, the inference latency of the present invention is significantly reduced, which can better meet the real-time requirements;

[0039] (6) Compared with differential privacy and traditional desensitization methods, the answer utility of the present invention is higher, it can better preserve the information and semantics of the original data, and improve the quality and accuracy of the answer.

[0040] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1This is a flowchart of the retrieval enhancement generation system based on model segmentation reasoning and privacy enhancement knowledge base;

[0042] Figure 2 This is the architecture diagram of the retrieval enhancement generation system based on model segmentation reasoning and privacy enhanced knowledge base.

[0043] Figure 3 It is a flow chart for constructing a privacy protection knowledge base based on the privacy masking module.

[0044] Figure 4 It is a bar chart comparing the performance of the method of the present invention and the traditional method. DETAILED DESCRIPTION

[0045] The following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.

[0046] The following are the detailed implementation steps of the present invention:

[0047] Implement a retrieval-enhanced generation system based on model segmentation reasoning and privacy-enhanced knowledge base, such as Figure 1 As shown, the system is first deployed. The user-side, edge-side subsystem, and cloud-edge subsystem must be deployed on the user's selected user device, edge-side device, and cloud server, respectively. User authentication information is entered into the edge subsystem, and the edge-side subsystem's authentication information is entered into the cloud subsystem. After deployment, a retrieval-enhanced generation method based on model segmentation reasoning and a privacy-enhanced knowledge base is implemented. This method is divided into two phases: offline and online.

[0048] 1. The offline phase includes the following steps:

[0049] S1.1. The user end cleans and segments the original knowledge document, generates structured knowledge fragments, and sends them to the edge terminal system. After being transformed by the embedded model, they are stored in the original knowledge layer of the privacy-preserving knowledge base.

[0050] S1.2. The user end masks the private content in the knowledge fragment through the privacy masking module, generates a privacy-masked knowledge fragment, sends it to the edge subsystem, and stores it in the privacy-masking knowledge layer of the privacy protection knowledge base.

[0051] S1.3. The user end generates a privacy mapping table for the knowledge fragment and sends it to the edge subsystem, where it is stored in the privacy mapping table layer of the privacy-preserving knowledge base.

[0052] S1.4. When using this architecture for the first time, the large language model needs to be divided into an embedding layer, an intermediate layer, and an output layer. The embedding layer and the output layer are deployed in the edge subsystem, and the intermediate layer is deployed in the cloud subsystem.

[0053] 2. The online phase includes the following steps:

[0054] S2.1. The edge subsystem authenticates the user, and the cloud subsystem authenticates the edge subsystem. After authentication, the user enters a question, which is then transmitted from the user to the edge subsystem and then input into the RAG interaction module. It should be noted that both the cloud subsystem and the edge subsystem include authentication modules, one for authenticating the edge subsystem and the user, respectively, for this communication.

[0055] S2.2, the RAG interaction module uses the embedding model to vectorize the natural language questions input by the user, selects the knowledge base content allowed by the user's identity information, and matches the knowledge content fragments with high similarity in the original knowledge layer in the privacy-preserving knowledge base based on the vector similarity.

[0056] S2.3. The RAG interaction module obtains the privacy-masked version of the knowledge fragment and the privacy mapping table in the privacy-protected knowledge base, replaces the private content that appears in the privacy mapping table in the natural language question input by the user with the masked content, and constructs a prompt together with the privacy-masked knowledge and the natural language question input by the user.

[0057] S2.4. Prompts that through reasoning at the embedding layer, an embedding vector is generated and uploaded to the cloud subsystem.

[0058] S2.5. After executing the middle layer inference, the cloud subsystem returns the hidden state vector to the edge subsystem.

[0059] S2.6. The edge terminal system generates a preliminary answer based on the received hidden state vector through the output layer, and hands it over to the RAG interaction module to restore the masked content in the answer to sensitive content based on the privacy mapping table and return it to the user end.

[0060] Preferably, the privacy masking knowledge generation method of the privacy masking module can select any one of the privacy masking methods based on a large language model, a structured masking method based on regular expressions, and a masking method based on named entity recognition according to the needs:

[0061] Method 1: Privacy masking method based on large language model: input a preset prompt word template into the large language model, the template contains instructions and predefined masking format, the large language model performs semantic analysis on the original knowledge fragment, identifies the sensitive content category and specific content, and then selects the corresponding content according to the masking ratio coefficient. , randomly selected Sensitive content is masked to generate masked content, where the masked content format is "masking character + unique identifier", and the remaining The original plaintext of sensitive content is retained to generate privacy-shielded knowledge.

[0062] Method 2: Structured masking method based on regular expressions: predefine regular expression matching rules and masking content templates for sensitive fields, perform regular matching on original knowledge fragments, and use masking ratio coefficients to select the appropriate content. , randomly selected sensitive content is masked, and the remaining The sensitive content is retained in plain text and privacy masking knowledge is generated.

[0063] Method 3: Masking method based on named entity recognition: The knowledge content will be identified as sensitive content through a fine-tuned named entity recognition model, and the masking ratio coefficient will be used to identify the sensitive content. , randomly selected sensitive content is masked, and the remaining The sensitive content is retained in plain text and privacy masking knowledge is generated.

[0064] The masking formulas for the above three methods are as follows:

[0065] ,

[0066] in, is a privacy-masking piece of knowledge, It is a privacy masking module. is the privacy masking ratio, , is non-private content, It is the masking content. is the private content, and N is the number of private contents.

[0067] Preferably, the privacy mapping table construction method of the privacy masking module can select one of the following two methods according to the needs:

[0068] Method 1: Privacy mapping table generation method based on a large language model: The original knowledge and masked knowledge are spliced ​​as input, and additional prompt words contain instructions and a predefined output format. The large language model parses the context and outputs a set of mapping entries, which are stored in the privacy mapping table layer.

[0069] Method 2: Privacy mapping table generation method based on generated records: This method can be used when privacy masking knowledge is generated using regular expressions and named entity recognition. According to the location of sensitive content in the record and the order of replacement, the "original content-masked content" pair is automatically generated, and the privacy mapping table is constructed in the order of masked content identifiers and stored in the privacy mapping table layer.

[0070] For example, "Zhang San" is masked as "Patient A", where "person" is the masking character and "A" is the identifier, and "Zhang San-Patient A" is stored in the privacy mapping layer.

[0071] Preferably, in S2.2, the system uses cosine similarity as a similarity measurement formula in the knowledge base matching stage to evaluate the semantic similarity between the natural language question input by the user and the knowledge fragment. Specifically, the cosine similarity calculation formula is as follows:

[0072] ,

[0073] in, A vectorized representation of the natural language question entered by the user, Represents the vectorized representation of a fragment in the knowledge base, and They are vectors and The system vectorizes the user's natural language question and all the segments in the knowledge base, using the above formula to calculate the similarity between each segment and the user. During implementation, the system returns the top k segments with the highest similarity scores as candidate matches for subsequent masked knowledge concatenation and prompt word generation.

[0074] To deploy this system, you first need to deploy the system's user end, edge subsystem, and cloud-edge subsystem on the user-end device, edge device, and cloud server selected by the user, and enter the user-end identity authentication information in the edge subsystem and the edge subsystem identity authentication information in the cloud subsystem.

[0075] Example

[0076] This embodiment provides an application of a retrieval enhancement generation method based on privacy content masking and model segmentation reasoning to medical records. The method is divided into two stages: offline and online.

[0077] S1.1. Please refer to Figure 2 and Figure 3 During the offline phase, users upload medical records containing patient health data. Users can select the maximum length of a single piece of knowledge and the maximum number of overlapping characters between two adjacent pieces of knowledge. The system removes redundant symbols (such as special characters and headers and footers) from the document and segments it into structured knowledge segments by paragraph. For example, the text "Patient Zhang San, blood glucose test value in May 2024 was 6.5mmol / L" is segmented into independent knowledge segments and stored in the original knowledge layer of the privacy-preserving knowledge base.

[0078] S1.2. The user selects "Patient Name" as the privacy category to be masked. The system uses a structured masking method to replace the matching names with the masked content "Patient A," "Patient B," and so on, in sequence based on the regular expression of names. For example, the text "Patient Zhang San, blood glucose test value is 6.5mmol / L" is masked to "Patient A, blood glucose test value is 6.5mmol / L."

[0079] S1.3. The system records the correspondence between the original content and the masked content (e.g., “Zhang San - Patient A”) and stores it in the privacy mapping layer.

[0080] S1.4. Split the large language model llama3-8B. The embedding layer and output layer are deployed in the hospital's local edge subsystem, responsible for text vectorization and answer generation. The middle layer is deployed in the cloud and undertakes core inference calculations.

[0081] S2.1. User authentication and input are performed in the online stage. After the doctor passes the identity authentication, he enters the query: "What is Zhang San's physical condition?" The question is transmitted to the edge terminal system.

[0082] S2.2. The edge terminal system uses an embedding model to convert the natural language questions entered by the user into vectors. Doctors are allowed to access knowledge bases containing patient privacy information, but are not allowed to access knowledge bases containing hospital financial information. The system then calculates the cosine similarity between the vector corresponding to the user's natural language question and all the segment vectors in the original knowledge layer. In this example, the number of retrieved knowledge segments is set to k = 1. Based on the vector similarity, the segment "Patient Zhang San, blood glucose test value 6.5mmol / L" is masked as "Patient A, blood glucose test value 6.5mmol / L."

[0083] S2.3. Obtain the masked version of the corresponding segment, "Patient A, blood glucose test value is 6.5mmol / L," and the corresponding privacy mapping table content from the masked knowledge layer. Based on the privacy mapping table, convert the user's natural language question into: "What is Patient A's physical condition?" Combine the user's natural language question with the masked knowledge to form a prompt: "Question: What is Patient A's physical condition? Reference knowledge: Patient A, blood glucose test value is 6.5mmol / L."

[0084] S2.4, the embedding layer encodes the prompt into an embedding vector and uploads it to the cloud subsystem.

[0085] S2.5. The middle layer of the cloud subsystem performs inference, generates a hidden state vector and returns it to the edge subsystem.

[0086] S2.6. The output layer decodes the hidden state vector and generates a preliminary answer: "Patient A is in good health, and his blood glucose value is 6.5 mmol / L." The RAG interaction module replaces "Patient A" in the answer with the original name "Zhang San" based on the privacy mapping table, and finally returns: "Zhang San is in good health, and his blood glucose value is 6.5 mmol / L."

[0087] The present invention is applicable to the retrieval enhancement generation needs of various privacy-sensitive scenarios such as medical, industrial and financial. By splitting the large language model to the edge and the cloud, and combining it with the privacy-enhanced knowledge base, the system processes the natural language questions and reasoning results input by the user locally to prevent the leakage of plain text in the cloud. Dynamic masking is combined with privacy mapping table recovery to flexibly balance privacy protection and semantic integrity, and solve the problems of information loss and decreased answer utility of traditional methods. In the medical embodiment, the patient's name "Zhang San" was masked as "Patient A" and accurately restored in the large model answer, verifying the system's effective coordination between privacy and accuracy. From Figure 4 It can be seen that the system can significantly reduce the risk of privacy leakage in the retrieval enhancement generation system.

[0088] Therefore, this paper, through the deep integration of model segmentation reasoning and a privacy-enhancing knowledge base, provides an efficient and secure retrieval-enhanced generation solution for privacy-sensitive data interaction. While mitigating the risk of privacy leakage, the system ensures the accuracy and usability of generated results, providing innovative technical support for the privacy protection needs of retrieval-enhanced generation scenarios such as industrial parameters and medical records.

[0089] The present invention provides a retrieval enhancement generation method and system based on privacy content masking and segmentation reasoning, including a large language model segmentation reasoning method, a privacy-enhancing knowledge base architecture for dynamic masking and recovery of knowledge base privacy content, and other privacy protection mechanisms. By segmenting the large language model into an embedding layer and an output layer deployed at the edge, and an intermediate layer deployed in the cloud, it ensures that the user's natural language questions and the plain text of the reasoning results are only processed locally, preventing the risk of plain text leakage in the cloud; at the same time, a three-layer privacy-enhancing knowledge base is constructed, and the original knowledge is dynamically masked by the privacy masking module in the offline stage, and a privacy mapping table of private content and masked content is generated, and combined with the masking ratio coefficient Regulate the amount of private information exposed to achieve a balance between the risk of privacy leakage and the utility of reasoning. The system supports multiple privacy masking methods, including structured masking based on regular expressions, context-aware masking driven by large language models, and named entity recognition masking. The system adapts to the needs of multiple scenarios such as industrial parameters, medical records, and financial data. The system eliminates all threats from attacks on plaintext from the cloud and during communication through segmented reasoning, and uses a privacy-enhancing knowledge base to greatly reduce the risk of privacy leakage when the system is attacked against ciphertext tensors. In addition, the system controls access to the privacy-protected knowledge base based on user permissions, reducing the risk of privacy leakage from within the enterprise. The system takes into account the privacy, low latency, and high availability of the retrieval enhancement generation system.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solutions of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A retrieval enhancement generation method based on privacy content masking and segmentation reasoning, characterized by: The method includes two stages: offline and online; wherein, The offline phase includes the following steps: S1.

1. The user cleans and segments the original knowledge document to generate structured knowledge fragments. Each knowledge fragment is converted into a corresponding knowledge vector using an embedding model and stored in the original knowledge layer of the privacy-preserving knowledge base. S1.

2. The user terminal masks the private content in each knowledge segment to generate a privacy-masked knowledge segment, which is stored in the privacy-masked knowledge layer of the privacy-preserving knowledge base. S1.

3. The user generates a privacy mapping table for the knowledge fragment and stores it in the privacy mapping table layer of the privacy-preserving knowledge base. S1.

4. Split the large language model into an embedding layer, an intermediate layer, and an output layer. The embedding layer and the output layer are deployed in the edge subsystem, and the intermediate layer is deployed in the cloud subsystem. The edge subsystem also deploys the embedding model and the privacy-preserving knowledge base. The online phase consists of the following steps: S2.

1. The edge terminal system authenticates the user terminal, and the cloud subsystem authenticates the edge terminal system. After authentication, the natural language question entered by the user is transmitted from the user terminal to the edge terminal system. S2.

2. Use the embedding model to convert the natural language question input by the user into a corresponding input vector, and match it with the k knowledge fragments with the highest similarity in the original knowledge layer of the privacy-preserving knowledge base; S2.

3. Based on the privacy mapping table corresponding to the matched knowledge fragments in the privacy-preserving knowledge base, mask the private content in the natural language question input by the user to generate a privacy-masked input. This privacy-masked input is used as the question and the privacy-masked knowledge fragments corresponding to the k knowledge fragments in the privacy-preserving knowledge base with the highest similarity to the input vector are used as reference knowledge to construct a prompt. S2.4, the embedding layer of the large language model converts the prompt into a corresponding embedding vector and uploads it to the cloud subsystem; S2.

5. After the cloud subsystem performs the middle-layer inference of the large language model, it returns the hidden state vector to the edge subsystem. S2.6, the edge terminal system generates a preliminary answer based on the received hidden state vector through the output layer of the large language model; S2.

7. Based on the privacy mapping table, the masked content in the preliminary answer is restored to the private content, and the final answer is generated and returned to the user end.

2. The method according to claim 1, characterized in that Privacy masking knowledge generation supports the following three methods: generation based on semantic understanding of a large language model, generation based on regular expression matching of private content, and generation based on a named entity recognition model. Each masking content used to mask private content consists of a masking symbol and an identifier.

3. The method according to claim 2, characterized in that Generation based on semantic understanding of large language models includes: Input the preset prompt word template into the large language model. The template contains instructions and predefined masking format. The large language model performs semantic analysis on the original knowledge fragment, identifies the sensitive content category and specific content, and , randomly selected Sensitive content is masked to generate masked content, where the masked content format is "masking character + unique identifier", and the rest The original plaintext of sensitive content is retained to generate privacy-masked knowledge fragments.

4. The system according to claim 2, wherein: Generating privacy content based on regular expression matching includes: Predefine regular expression matching rules and masking content templates for sensitive fields, perform regular matching on original knowledge fragments, and use masking ratio coefficients to identify the original knowledge fragments. , randomly selected sensitive content is masked, and the remaining The original plaintext of sensitive content is retained to generate privacy-masked knowledge fragments.

5. The method according to claim 2, characterized in that Generation based on named entity recognition model includes: The knowledge content will be identified as sensitive content through a fine-tuned named entity recognition model, and the masking ratio coefficient , randomly selected sensitive content is masked, and the remaining The original plaintext of sensitive content is retained to generate privacy-masked knowledge fragments.

6. The method according to claim 2, characterized in that The masking formula is as follows: , in, is a privacy-masking piece of knowledge, is the privacy masking ratio, Non-private content, It is the masking content. is the private content, and N is the number of private contents.

7. The method according to claim 2, characterized in that When generating privacy-masked knowledge based on a large language model, the corresponding privacy mapping table generation method is as follows: the original knowledge and the masked knowledge are concatenated as input, and additional prompt words contain instructions and a predefined output format. The large language model parses the context and outputs a set of mapping entries, which are then stored in the privacy mapping table layer.

8. The method according to claim 2, characterized in that When generating privacy masking knowledge based on regular expressions and named entity recognition models, the corresponding privacy mapping table generation method is as follows: according to the location and replacement order of the recorded sensitive content, "original content-masked content" pairs are automatically generated, and a privacy mapping table is constructed in the order of masked content identifiers and stored in the privacy mapping table layer.

9. A search enhancement generation system based on the method according to claims 1 to 8, characterized in that: The system includes a user terminal, an edge subsystem, and a cloud subsystem, wherein: The user end includes an interactive module and a privacy shielding module: The interactive module is used to receive natural language questions input by users and return the final answer; The privacy masking module is used to construct privacy masking knowledge fragments in the privacy protection knowledge base of the edge subsystem; The edge terminal system includes an embedding model, the embedding layer and output layer of the large language model, a privacy-preserving knowledge base, and a RAG interaction module: The embedding model is used to convert knowledge fragments and natural language questions input by users into vector representations to obtain knowledge vectors and input vectors; The embedding layer of the large language model is used to convert the prompt into the corresponding embedding vector; The output layer of the large language model is used to receive the hidden state vector and generate a preliminary answer; The privacy-preserving knowledge base is divided into the original knowledge layer, the privacy-masking knowledge layer, and the privacy mapping table layer, which respectively store knowledge vectors, privacy-masking knowledge fragments, and privacy mapping tables; The RAG interaction module is used to construct prompts and restore the masked content in the preliminary answer to private content to generate the final answer; The cloud subsystem includes the middle layer of the large language model, which is used to receive prompts, generate hidden state vectors and return them to the edge subsystem.

Citation Information

Cited By

  • Large language model privacy protection type retrieval enhancement generation method and system

    CN121807997A