Secure knowledge base data retrieval method and system oriented to generative large language model

By adopting an architecture that separates indexes, data, and keys in generative large language models, the problems of data storage security risks and lack of separation of permissions are solved, enabling highly secure and privacy-protected knowledge base data retrieval and improving the reliability and accuracy of generative AI in professional fields.

CN121786076APending Publication Date: 2026-04-03山东三未信安信息科技有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-15
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies, when combining generative large language models with external knowledge bases, have issues such as data storage security risks, lack of separation between vector comparison and slice acquisition permissions, and mismatch in encryption granularity, which cannot meet the security requirements of highly sensitive fields.

Method used

The system adopts an architecture that separates indexes, data, and keys. It stores encrypted slice data in a cloud database, slice vectors in a vector query server, and slice subkeys in a key management center. The vector query server acts as a security proxy to negotiate temporary session keys for decryption and encryption, ensuring the security and privacy of data throughout its entire lifecycle.

Benefits of technology

It achieves the separation of data and keys, follows the principle of least privilege, blocks unauthorized access and data leakage paths, supports fine-grained access control, ensures the accuracy and credibility of generated answers, and improves the security and privacy protection capabilities of generative AI in professional fields.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786076A_ABST
    Figure CN121786076A_ABST
Patent Text Reader

Abstract

The invention discloses a secure knowledge base data retrieval method and system oriented to a generative large language model. The encrypted slice data is stored in the cloud database, the slice vector is stored in the vector query server, and the decryption key derived by the slice vector and the identifier is stored in the key management center. During retrieval, a client sends a query vector to a vector query server for similarity matching, after a target slice identifier is determined, the vector query server is used as a security agent to obtain encrypted slice data and a decryption key, and after the decryption key is used for decryption in a security memory, the encrypted slice data and the decryption key are stored in the security memory. And immediately re-encrypting by using a temporary session key negotiated with the client, and generating a client exclusive ciphertext and returning the client exclusive ciphertext. And the client decrypts to obtain knowledge fragments and combines the knowledge fragments with the large language model to generate answers. According to the method, fine-grained encryption, permission separation and end-to-end protection oriented to the large language model knowledge base are realized, the retrieval efficiency is maintained while high security is guaranteed, and the method is suitable for high-sensitivity fields such as government affairs and finance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and data security technology, and more specifically to a secure knowledge base data retrieval method and system based on vector-derived keys for generative large language models, aiming to provide enhanced retrieval capabilities for generative AI applications that are secure, reliable, and privacy-protected. Background Technology

[0002] In recent years, generative large language models (LLMs), represented by GPT and LLaMA, have made groundbreaking progress in natural language understanding, generation, and interaction, profoundly changing various industries. However, LLMs themselves have two major flaws: first, the knowledge illusion problem, where the model may generate seemingly reasonable but factual content; and second, the knowledge timeliness problem, where the model's knowledge base is limited by the training data and cannot acquire new information that occurs after the training deadline.

[0003] Retrieval Enhanced Generation (RAG) is one of the important methods to solve these problems. The core idea of ​​RAG is to combine LLM (Limited Learning Model) with an external knowledge base. When a user asks a question, the system first retrieves the most relevant knowledge fragments from the knowledge base, and then provides these fragments as context along with the user's question to the LLM, guiding it to generate an answer based on accurate and reliable external knowledge. This architecture improves the accuracy and reliability of the LLM's answers and enables it to dynamically utilize the latest information. In professional fields with extremely high requirements for information accuracy and security, such as government services, finance, healthcare, and law, RAG technology shows great application potential. For example, it can build intelligent government Q&A systems based on massive amounts of policies, regulations, and service guides, or financial consulting and medical auxiliary diagnosis systems based on internal knowledge bases. However, the knowledge bases in these application scenarios usually contain a large amount of sensitive or confidential data. When applying RAG technology to these high-security fields, existing technical solutions face severe security challenges: 1. Data Storage Security Risks. To achieve high performance and scalability, RAG systems typically deploy knowledge base data (including original documents and vector indexes) on third-party cloud platforms. Original document slices containing sensitive information may be stored in plaintext or with weak protection in a cloud environment beyond direct control. Attacks on cloud service providers, the presence of malicious insiders, or unauthorized actions by the cloud service provider itself can all lead to privacy data breaches.

[0004] 2. Vector comparison and slice retrieval permissions are not separated. In a typical RAG architecture, the vector database responsible for semantic retrieval and the document library responsible for storing raw documents are often managed and have unified permissions, and may even be deployed in the same service instance. This design means that services or administrators authorized to access vector indexes to execute queries also inherently possess the ability to access and read the plaintext data pointed to by their indexes. This violates the principle of least privilege in security design. Once the service is compromised or internally abused, attackers can not only know which information is relevant, but also directly obtain the specific content of this information, leading to the complete leakage of sensitive data.

[0005] 3. The encryption granularity is mismatched with the basic unit of RAG. Traditional encryption typically operates at the file or document level, using a single key to encrypt the entire document. However, the core operational unit of RAG technology is a document chunk. If document-level encryption is used, when the retrieval system locates a chunk, it cannot decrypt only that chunk; it must first obtain the ciphertext of the entire document and decrypt it using its key. This not only introduces unnecessary computation and I / O overhead, but more importantly, the security strategy cannot be implemented down to the smallest data unit of RAG, resulting in excessively coarse security granularity.

[0006] In summary, existing technologies have significant shortcomings in building secure knowledge bases for generative large language models, and face core challenges such as data and key separation, fine-grained encryption, and privacy protection during the query process. Existing technical solutions cannot meet the stringent data security requirements of highly sensitive fields such as government affairs and finance.

[0007] Therefore, designing a technical solution for a knowledge base data retrieval method and system that can fully leverage the advantages of RAG technology in empowering LLM, while ensuring high security and privacy protection capabilities for knowledge base data throughout its entire lifecycle of static storage, dynamic retrieval, and end-to-end transmission, is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0008] In view of the above problems, the present invention is proposed to provide a secure knowledge base data retrieval method and system for generative large language models that overcomes or at least partially solves the above problems.

[0009] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, embodiments of the present invention provide a secure knowledge base data retrieval method for generative large language models, wherein encrypted slice data of document slices in the original document is stored in a cloud database. and the slice identifier uniquely bound to it. ; The vector query server stores the slice vectors of document slices from the original document. and the slice identifier uniquely bound to it. The slice vector The embedding vector corresponding to the document slice; The key management center stores data based on slice vectors. and corresponding slice identifier Derived slice key ; The retrieval method includes the following steps: The client receives a query request from a user, converts the query request into a query vector, and sends it to a vector query server. The vector query server then uses the query vector and the slice vector to perform the query. Perform similarity retrieval to determine the target slice identifier corresponding to one or more target slice vectors; Based on the target slice identifier, obtain the corresponding target encrypted slice data from the cloud database, and obtain the slice subkey for decrypting the target encrypted slice data from the key management center. ; The vector query server, acting as a security proxy, negotiates a temporary session key with the client and uses the slice subkey in its securely accessible memory. Decrypt the target encrypted slice data to obtain the target document slice. Encrypt the target document slice using a temporary session key, generate client-specific ciphertext, and send it to the client so that the client can use the temporary session key to decrypt and obtain the target document slice. The client combines the target document slice with the user query request to form a prompt, and submits it to the large language model to generate an answer.

[0010] Preferably, before the steps of the retrieval method, a cloud database construction step is also included: Semantic segmentation is performed on the original document to obtain multiple document slices. And store; Construct the document slice Metadata, which includes: a unique identifier for the public service institution. Original document unique identifier Document category tags and document slice unique identifier Wherein, the public institution refers to the public service institution to which the original document belongs; each document slice Each is bound to unique metadata and stored; Using the slice key For the document slice Encryption is performed to obtain encrypted slice data. And store it, while storing the slice vector and its slice identifier to the vector query server.

[0011] Preferably, before the steps of the retrieval method, a step of constructing a vector query server is also included: Based on a pre-trained text embedding model, each document is sliced. The text content is converted into the corresponding slice vector. And store; Construct the document slice Metadata, which includes: a unique identifier for the public service institution. Original document unique identifier Document category tags and document slice unique identifier Wherein, the public institution refers to the public service institution to which the original document belongs; each document slice Each is bound to unique metadata and stored.

[0012] Preferably, the key management center derives the slice subkey. The steps include: The slice vector , and their corresponding unique identifiers for document slices The key is concatenated to form the master key seed; The master key seed is input into the key derivation function, and the output is the slice vector. Corresponding slice key The cryptographic algorithm used to construct the key derivation function participates in the encrypted slice data. The encryption steps.

[0013] Preferably, the master key seed further includes at least one of the following: a unique identifier for a public service institution. Original document unique identifier Document category tags And random numbers.

[0014] Preferably, the cryptographic algorithm used to construct the key derivation function is a symmetric encryption algorithm.

[0015] Preferably, the vector query server and the client negotiate and generate the temporary session key using a digital envelope algorithm.

[0016] Preferably, the vector query server encrypts the target document slice using a temporary session key, generates client-specific ciphertext, and deletes the target document slice from the memory.

[0017] Preferably, the cloud database is a professional knowledge base in the fields of government services, finance, healthcare, or law.

[0018] Secondly, embodiments of the present invention provide a secure knowledge base data retrieval system based on the aforementioned secure knowledge base data retrieval method for generative large language models, comprising: a vector query server, a cloud database, a key management center, and a client; wherein: The cloud database is configured to store encrypted slice data of document slices in the original document. and the slice identifier uniquely bound to it. ; The vector query server is configured to store slice vectors of document slices in the original document. and the slice identifier uniquely bound to it. The slice vector The embedding vector corresponding to the document slice; The key management center is configured to store data based on the slice vector. and corresponding slice identifier Derived slice key ; The client is configured to receive and respond to user query requests, convert the query requests into query vectors, and send them to the vector query server; The vector query server is also configured to: Based on the query vector and the slice vector Perform similarity retrieval to determine the target slice identifier corresponding to one or more target slice vectors; Based on the target slice identifier, obtain the corresponding target encrypted slice data from the cloud database, and obtain the slice subkey for decrypting the target encrypted slice data from the key management center. ; The vector query server, acting as a security proxy, negotiates a temporary session key with the client and uses the slice subkey in its securely accessible memory. Decrypt the target encrypted slice data to obtain the target document slice, encrypt the target document slice using a temporary session key, generate client-specific ciphertext, and send it to the client; The client is also configured to: use the temporary session key to decrypt the client-specific ciphertext to obtain the target document slice, combine the target document slice with the query request to form a prompt, and submit it to the large language model to generate an answer.

[0019] The technical solution provided in this invention systematically improves the security of knowledge base retrieval for generative large language models by constructing a secure architecture that separates indexes, data, and keys. Specific beneficial effects include at least the following: This invention stores encrypted data, vector indexes, and decryption keys in separate cloud databases, vector query servers, and key management centers. If any one of these components is compromised, the complete plaintext cannot be obtained independently. By adhering to the principle of least privilege, this invention fundamentally blocks unauthorized access and data leakage paths.

[0020] This invention dynamically derives unique keys from the semantic vectors and metadata of document slices, achieving precise matching between encryption granularity and document slices. It supports fine-grained access control based on content, source, or category, avoiding the coarseness and inefficiency of traditional document-level encryption.

[0021] The vector query server of this invention acts as a security proxy, ensuring that plaintext exists only momentarily in memory, and is encrypted throughout transmission and storage, thus eliminating the risk of third-party services stealing or persisting plaintext data.

[0022] The contextual knowledge fragments provided by this invention for LLM are all subject to strict permission verification and integrity protection, ensuring the factual accuracy and authority of the generated answers from the source, effectively suppressing knowledge illusions, and improving the credibility of AI output results in professional fields.

[0023] In summary, this invention systematically addresses the full lifecycle security challenges faced by sensitive knowledge bases in RAG applications, providing a secure foundation for the reliable application of generative AI in critical industries. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0025] Figure 1 This is a schematic diagram of the secure knowledge base data retrieval method for generative large language models provided in this embodiment of the invention. Figure 2 This is a schematic diagram of the security knowledge base data retrieval system architecture provided in an embodiment of the present invention; Figure 3 This is a flowchart of the data upload and encryption process provided in this embodiment of the invention; Figure 4 This is a flowchart of data security query and data acquisition provided in this embodiment of the invention. Detailed Implementation

[0026] 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, and 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.

[0027] This invention discloses a secure knowledge base data retrieval method for generative large language models, which stores encrypted slice data of document slices in the original document in a cloud database. and the slice identifier uniquely bound to it. ; The vector query server stores the slice vectors of document slices from the original document. and the slice identifier uniquely bound to it. slice vector The embedding vector corresponding to the document slice; The key management center stores data based on slice vectors. and corresponding slice identifier Derived slice key ; The retrieval method includes the following steps: The client receives the query request sent by the user and converts the query request into a query vector. And send it to the vector query server so that the vector query server can calculate it in its index. With all stored slice vectors The similarity between documents, such as cosine similarity, is used to select one or more document slices with the highest similarity, resulting in a list of identifiers for related slices. ; Based on the target slice identifier, retrieve the corresponding target encrypted slice data from the cloud database. Obtain the slice subkey from the key management center to decrypt the target encrypted slice data. ; The vector query server acts as a security proxy, negotiating with the client to generate a temporary session key, and then storing it in its securely accessible memory using a slice subkey. Decrypt the target encrypted slice data to obtain the target document slice. Use a temporary session key to encrypt the target document slice, generate client-specific ciphertext, and send it to the client so that the client can use the temporary session key to decrypt and obtain the target document slice. The client combines the user's original query with the decrypted knowledge fragments to construct a structured hint. This hint typically consists of three parts: system instructions, contextual knowledge (i.e., the decrypted fragments), and the user's question. The client then submits this complete hint to a local or remote Large Language Model (LLM). Based on the provided contextual knowledge, the LLM understands and reasons about the user's question, generating an accurate, reliable, and fact-based final answer, which is then presented to the user.

[0028] In one embodiment, a cloud database construction step is included before the retrieval method step: Semantic segmentation is performed on the original document to obtain multiple document slices. And store; during specific execution, the original document is segmented using a preset slice size (for example, a fixed value is selected within the range of 4K, 8K, 16K or 32K Token, such as 8K Token) (Token is a word unit, which is a document identifier unit) to generate multiple semantically relatively independent document slices.

[0029] Build document slices Metadata, which includes: unique identifiers for public service institutions. Original document unique identifier Document category tags and document slice unique identifier Among them, public institutions refer to the public service institutions to which the original document belongs; each document slice Each document is bound to unique metadata and stored; among which, the document's category tags This includes: tax policies, social security procedures, and business registration.

[0030] Use slice key Slicing documents Encryption is performed to obtain encrypted slice data. The slice vector and its slice identifier are stored in the vector query server; during execution, a subkey is used. Plaintext of document slices using the symmetric cryptographic algorithm (SM4) Encryption is performed to generate corresponding encrypted slice data. The encryption process can be represented as:

[0031] To ensure data integrity, in modes such as GCM-Galois / Counter Mode, an authentication tag is generated simultaneously during the encryption process.

[0032] Encrypted slice data and its corresponding metadata (such as (But excluding the key) is uploaded and stored in a third-party cloud database. This cloud database is only responsible for storing the ciphertext and has no knowledge of any decryption key or plaintext information, thus ensuring the confidentiality of data storage.

[0033] In one embodiment, a vector query server construction step is included before the retrieval method step: Based on a pre-trained text embedding model, each document is sliced. The text content is converted into the corresponding slice vector. And store; in actual execution, the text embedding model can be any of the following: BERT, Sentence-BERT, or OpenAI's text-embedding-ada-002, etc. Slice each document. The text content is converted into a high-dimensional dense slice vector. The vector It mathematically represents the semantic information of sliced ​​text.

[0034] Build document slices Metadata, which includes: unique identifiers for public service institutions. Original document unique identifier Document category tags and document slice unique identifier Among them, public institutions refer to the public service institutions to which the original document belongs; each document slice Each is bound to unique metadata and stored.

[0035] The vector query server utilizes fast and efficient calculation of vector cosine similarity to retrieve knowledge fragments relevant to the question. This server handles semantic retrieval but does not store any plaintext document content or decryption keys, achieving a physical separation between the data index and the data content.

[0036] In one embodiment, during the retrieval step, the client uses the natural language question text input by the user and generates slice vectors using a cloud database. The same text embedding model is used to convert the query vector. .

[0037] In one embodiment, the Key Management Center (KMC) is independent of the cloud database and vector query server, and the KMC derives the slice subkeys. The steps include: slice vector , and their corresponding unique identifiers for document slices Perform ordered concatenation to form the master key seed. ; The master key seed is input into the key derivation function, and the output is the slice vector. Corresponding slice key The cryptographic algorithm used to construct the key derivation function is used to encrypt the sliced ​​data. The encryption steps.

[0038] In one embodiment, the master key seed It also includes at least one of the following: a unique identifier for a public service organization. Original document unique identifier Document category tags And a random number. To enhance security, a random number is added during the concatenation process. Its formula can be expressed as:

[0039] in, This indicates a byte-level concatenation operation.

[0040] In this embodiment, the cryptographic algorithm used to construct the key derivation function is a symmetric encryption algorithm. In specific execution, the symmetric cryptographic algorithm SM4 is used as the core to construct a key derivation function (KDF). As input, a fixed-length (e.g., 128-bit) symmetric subkey is derived from this KDF. This process ensures that the key for each slice is strongly correlated with its content, origin, and category, achieving a one-to-one key binding relationship for all slices.

[0041] In this embodiment, the vector query server and the client negotiate and generate a temporary session key using a digital envelope algorithm. During execution, the client generates a random key. Use vector lookup server public key The encrypted data is sent to the server; the server uses its own private key. Decryption, thereby obtaining .

[0042] In one embodiment, the vector query server encrypts the target document slice using a temporary session key, generating client-specific ciphertext while simultaneously deleting the target document slice from memory.

[0043] The encryption and decryption process for the temporary session key is as follows: First, use the subkey obtained from KMC. Decrypt the corresponding encrypted slice Obtain plaintext slices :

[0044] Then, immediately use the negotiated client key. This plaintext slice Encryption is performed to generate new encrypted data that can only be decrypted by the client. :

[0045] In this process, plaintext It will not be persistently stored on the server. The vector query server uses the client key for all data. Encrypted slice data Send to the client.

[0046] The client uses its own client key. The received data packets are decrypted to recover the original plaintext knowledge fragments that are highly relevant to the query question. .

[0047] .

[0048] In one embodiment, the cloud database is a knowledge base for government services, finance, healthcare, or law.

[0049] Based on the same inventive concept, embodiments of the present invention also provide a secure knowledge base data retrieval system according to a secure knowledge base data retrieval method for generative large language models, comprising: a vector query server, a cloud database, a key management center, and a client; wherein: The cloud database is configured to store encrypted slice data of document slices from the original document. and the slice identifier uniquely bound to it. ; The vector query server is configured to store slice vectors of document slices from the original document. and the slice identifier uniquely bound to it. slice vector The embedding vector corresponding to the document slice; The key management center is configured to store data based on the slice vector. and corresponding slice identifier Derived slice key ; The client is configured to receive and respond to user query requests, convert the query requests into query vectors, and send them to the vector query server. The vector query server is also configured as follows: Based on query vector and slice vector Perform similarity retrieval to determine the target slice identifier corresponding to one or more target slice vectors; Based on the target slice identifier, obtain the corresponding target encrypted slice data from the cloud database, and obtain the slice subkey for decrypting the target encrypted slice data from the key management center. ; The vector query server acts as a security proxy, negotiating with the client to generate a temporary session key, and then storing it in its securely accessible memory using a slice subkey. Decrypt the target encrypted slice data to obtain the target document slice, encrypt the target document slice using a temporary session key, generate client-specific ciphertext, and send it to the client; The client is also configured to: use a temporary session key to decrypt client-specific ciphertext to obtain a slice of the target document, combine the target document slice with the query request to form a hint, and submit it to the large language model to generate an answer.

[0050] Since the principles underlying the problems solved by the vector query server, cloud database, key management center, and client are similar to the aforementioned data retrieval method for a secure knowledge base oriented towards generative large language models, the implementation of this system can refer to the implementation of the aforementioned method, and the repetitive parts will not be repeated.

[0051] like Figure 2 As shown, a data interaction scenario for a secure knowledge base data retrieval system for generative large language models is presented. Among them, such as... Figure 3 As shown, a specific implementation scenario describing the complete data upload and encryption process is presented: As a public service institution, the tax bureau is required to upload a policy document on special additional deductions for individual income tax to its cloud database.

[0052] Step 101: The tax bureau's data preprocessing module obtains an original policy document entitled "Interim Measures for Special Additional Deductions for Individual Income Tax".

[0053] Step 102: The data preprocessing module performs semantic slicing on the document according to the preset 8K Token size, generating multiple document slices, such as slice A (deduction for children's education), slice B (deduction for continuing education), slice C (deduction for major medical expenses), etc.

[0054] Step 103: The data preprocessing module uses a pre-trained Chinese text embedding model, such as the "BGE-large-zh" model, to convert the text content of slice A into a 1024-dimensional vector, denoted as... .

[0055] Step 104: The data preprocessing module constructs the master key material. For slice A, its master key material... It is composed of the following parts: the vector of slice A The tax bureau's organization ID (e.g., ID_tax), document category tag (e.g., tax policy), and the unique ID of slice A (e.g., chunk_A_001). That is:

[0056] Step 105: The data preprocessing module will... Send to the Key Management Center. KMC receives it. Then, using the SM4 algorithm as the core, and through a key derivation function (KDF), from... Derive a 128-bit subkey And then safely returned it to the tax authorities.

[0057] Step 106: The tax bureau's data preprocessing module uses a subkey. The plaintext of slice A is encrypted using SM4-GCM to generate ciphertext data. GCM mode provides both encryption and data integrity authentication.

[0058] Step 107: The tax bureau will encrypt the sliced ​​data. Its metadata (such as chunk_A_001) is uploaded to a third-party encrypted database for permanent storage.

[0059] Step 108: The tax bureau will use the vector of slice A The data, including its metadata (especially chunk_A_001), is uploaded to a third-party vector query server for indexing and storage. For slices B, C, etc., steps 103 to 108 are repeated to complete the secure upload of the entire document.

[0060] like Figure 4 As shown below, a specific implementation scenario is given to describe the complete process of a user initiating a secure query and obtaining a knowledge fragment.

[0061] Step 201: A user enters a specific query question in the client: "My child is in college, how do I fill in the additional education deduction?" Step 202: The client uses the same "BGE-large-zh" model as in the data upload phase to convert the question text into a query vector. .

[0062] Step 203: The client will query the vector Send to the vector query server.

[0063] Step 204: The vector query server receives... Then, a cosine similarity comparison was performed in its index. After calculation, the vector of slice A (regarding deductions for children's education) was found to be similar. And another vector of slice D related to the application process. and The cosine similarity was the highest. Therefore, the server determined the list of IDs for the relevant slices: {chunck_A_001, chunck_D_045}.

[0064] Step 205: The vector query server sends a request to the encrypted database based on the ID list to obtain the corresponding encrypted data. and .

[0065] Step 206: Simultaneously, the vector query server sends a request to the key management center to obtain the decryption key. and The required subkey. KMC re-derives or queries the slice ID and returns the corresponding subkey. and .

[0066] Step 207: The vector query server and the client negotiate a one-time client key using digital envelope technology. The specific process is as follows: The client generates a random 128-bit symmetric key as... The message is encrypted using the SM2 public key of the vector query server and sent; the server then decrypts it using its own SM2 private key, thus securely obtaining the message. .

[0067] Step 208: The vector query server performs decryption and re-encryption operations in its protected memory. use Decryption Obtain plaintext : ; use Decryption Obtain plaintext : ; Use immediately encryption and Generate new ciphertext and : After processing, the plaintext in memory and It was destroyed immediately.

[0068] Step 209: The vector query server will use the client key. Encrypted data packet Send to the client.

[0069] Step 210: The client uses its own client key. Decrypt the data packet to recover the plaintext knowledge fragments. and .

[0070] Step 211: The client combines the user's original question and the decrypted knowledge fragments into a structured hint and sends it to the Large Language Model (LLM) for final answer generation.

[0071] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0072] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A secure knowledge base data retrieval method for generative large language models, characterized in that, The cloud database stores encrypted slice data of document slices from the original document. and the slice identifier uniquely bound to it. ; The vector query server stores the slice vectors of document slices from the original document. and the slice identifier uniquely bound to it. The slice vector The embedding vector corresponding to the document slice; The key management center stores data based on slice vectors. and corresponding slice identifier Derived slice key ; The retrieval method includes the following steps: The client receives a query request from a user, converts the query request into a query vector, and sends it to a vector query server. The vector query server then uses the query vector and the slice vector to perform the query. Perform similarity retrieval to determine the target slice identifier corresponding to one or more target slice vectors; Based on the target slice identifier, obtain the corresponding target encrypted slice data from the cloud database, and obtain the slice subkey for decrypting the target encrypted slice data from the key management center. ; The vector query server, acting as a security proxy, negotiates a temporary session key with the client and uses the slice subkey in its securely accessible memory. Decrypt the target encrypted slice data to obtain the target document slice. Encrypt the target document slice using a temporary session key, generate client-specific ciphertext, and send it to the client so that the client can use the temporary session key to decrypt and obtain the target document slice. The client combines the target document slice with the user query request to form a prompt, and submits it to the large language model to generate an answer.

2. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, Prior to the steps in the retrieval method, a cloud database construction step is also included: Semantic segmentation is performed on the original document to obtain multiple document slices. And store; Construct the document slice Metadata, which includes: a unique identifier for the public service institution. Original document unique identifier Document category tags and document slice unique identifier Wherein, the public institution refers to the public service institution to which the original document belongs; each document slice Each is bound to unique metadata and stored; Using the slice key For the document slice Encryption is performed to obtain encrypted slice data. And store it, while storing the slice vector and its slice identifier to the vector query server.

3. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, Prior to the steps of the retrieval method, a step of constructing a vector query server is also included: Based on a pre-trained text embedding model, each document is sliced. The text content is converted into the corresponding slice vector. And store; Construct the document slice Metadata, which includes: a unique identifier for the public service institution. Original document unique identifier Document category tags and document slice unique identifier Wherein, the public institution refers to the public service institution to which the original document belongs; each document slice Each is bound to unique metadata and stored.

4. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, The key management center derives the slice key. The steps include: The slice vector , and their corresponding unique identifiers for document slices The key is concatenated to form the master key seed; The master key seed is input into the key derivation function, and the output is the slice vector. Corresponding slice key The cryptographic algorithm used to construct the key derivation function participates in the encrypted slice data. The encryption steps.

5. The secure knowledge base data retrieval method for generative large language models as described in claim 4, characterized in that, The master key seed also includes at least one of the following: a unique identifier for a public service institution. Original document unique identifier Document category tags And random numbers.

6. The secure knowledge base data retrieval method for generative large language models as described in claim 4, characterized in that, The cryptographic algorithm used to construct the key derivation function is a symmetric encryption algorithm.

7. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, The vector query server and the client negotiate to generate the temporary session key using a digital envelope algorithm.

8. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, The vector query server encrypts the target document slice using a temporary session key, generates client-specific ciphertext, and deletes the target document slice from memory.

9. The secure knowledge base data retrieval method for generative large language models as described in claim 1, characterized in that, The cloud database is a professional knowledge base in the fields of government services, finance, healthcare, or law.

10. A secure knowledge base data retrieval system based on the secure knowledge base data retrieval method for generative large language models as described in any one of claims 1 to 9, characterized in that, include: Vector query server, cloud database, key management center, and client; among which: The cloud database is configured to store encrypted slice data of document slices in the original document. and the slice identifier uniquely bound to it. ; The vector query server is configured to store slice vectors of document slices in the original document. and the slice identifier uniquely bound to it. The slice vector The embedding vector corresponding to the document slice; The key management center is configured to store data based on the slice vector. and corresponding slice identifier Derived slice key ; The client is configured to receive and respond to user query requests, convert the query requests into query vectors, and send them to the vector query server; The vector query server is also configured to: Based on the query vector and the slice vector Perform similarity retrieval to determine the target slice identifier corresponding to one or more target slice vectors; Based on the target slice identifier, obtain the corresponding target encrypted slice data from the cloud database, and obtain the slice subkey for decrypting the target encrypted slice data from the key management center. ; The vector query server, acting as a security proxy, negotiates a temporary session key with the client and uses the slice subkey in its securely accessible memory. Decrypt the target encrypted slice data to obtain the target document slice, encrypt the target document slice using a temporary session key, generate client-specific ciphertext, and send it to the client; The client is also configured to: use the temporary session key to decrypt the client-specific ciphertext to obtain the target document slice, combine the target document slice with the query request to form a prompt, and submit it to the large language model to generate an answer.