Retrieval enhancement generation method and device, computer equipment and readable storage medium

By maintaining a set of visited nodes locally on the client side and using the PIR protocol to encrypt the query list with auxiliary information, the problem of information leakage in traditional retrieval enhancement generation is solved, achieving a balance between information security protection and retrieval capabilities.

CN121858623APending Publication Date: 2026-04-14CHINA TELECOM BESTPAY CO LTD
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-12
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In traditional search-enhanced generation systems, the content of a user's query can be easily understood by remote knowledge base service providers, leading to information leakage and privacy preferences being compromised, thus failing to ensure information security.

Method used

The client maintains a set of visited nodes locally, encrypts the query list using local graph matching and PIR protocol auxiliary information, and the server performs a private search without decryption. The server then uses the local PIR protocol auxiliary information to decrypt and obtain the actual vector data, generating an enhanced answer. This ensures that the query semantics are preserved on the client and the server cannot infer the user's intent.

Benefits of technology

It achieves information security protection during the search enhancement generation process, blocks the leakage of sensitive information and access patterns, and improves information security while maintaining search capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121858623A_ABST
    Figure CN121858623A_ABST
Patent Text Reader

Abstract

The invention relates to a retrieval enhancement generation method and device, computer equipment and a readable storage medium. The method comprises the following steps: in response to a natural language query, determining M target nodes matched with the natural language query from an accessed node set to obtain an expanded neighbor node set; determining a neighbor node index of each node in the expanded neighbor node set from the neighbor list to obtain a batch query list; encrypting the batch query list based on the local PIR protocol auxiliary information to obtain a target encrypted PIR query message and sending the target encrypted PIR query message to a server; receiving an encryption answer fed back by the server, decrypting and recovering the encryption answer by using local PIR protocol auxiliary information to obtain a retrieval result, and updating an accessed node set; and if the target actual vector data matched with the natural language query exists in the retrieval result, performing enhancement processing on the target actual vector data to obtain an enhanced answer. By adopting the method, the problem of information leakage in the retrieval process can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information retrieval technology, and in particular to a retrieval enhancement generation method, apparatus, computer device, and readable storage medium. Background Technology

[0002] With the rapid development of large language model (LLM) capabilities, retrieval-augmented generation (RAG) technology has been widely used in various AI applications because it can effectively combine the generative capabilities of LLM with the accuracy of external knowledge.

[0003] In traditional RAG systems, user queries are sent to a remote knowledge base for retrieval. The knowledge base service provider has clear information about the specific content of the user's query, their areas of interest, and their access patterns, potentially leading to the leakage of sensitive information or privacy preferences. This retrieval method cannot guarantee information security. Therefore, a solution is needed to address information leakage during the retrieval process. Summary of the Invention

[0004] Therefore, it is necessary to provide a search enhancement generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can solve the problem of information leakage during the search process and improve information security, in order to address the above-mentioned technical problems.

[0005] Firstly, this application provides a retrieval enhancement generation method, applied to a client, including:

[0006] In response to a natural language query sent to a large language model, M target nodes matching the natural language query are determined from the set of visited nodes to obtain an expanded set of neighbor nodes; wherein, the set of visited nodes is determined based on a graph structure built on documents in the server, and each visited node in the set of visited nodes is used to represent vector data.

[0007] Obtain the list of neighbors corresponding to each of the visited nodes, determine the neighbor node index of each node in the expanded neighbor node set from the neighbor list, and obtain the batch query list;

[0008] Obtain local PIR protocol auxiliary information, encrypt the batch query list based on the local PIR protocol auxiliary information to obtain a target encrypted PIR query message, and send the target encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and the server jointly executing the PIR preprocessing protocol;

[0009] The system receives the encrypted answer from the server based on the target encrypted PIR query message, decrypts and recovers the encrypted answer using the local PIR protocol auxiliary information, obtains the actual vector data corresponding to each node index in the batch query list, and updates the set of visited nodes.

[0010] If the updated set of visited nodes and the set of expanded neighbor nodes contain target actual vector data that matches the natural language query, then the target actual vector data is augmented using the large language model to obtain an enhanced answer.

[0011] In one embodiment, the step of responding to a natural language query sent to a large language model, determining M target nodes matching the natural language query from the visited node set, and obtaining an expanded neighbor node set, includes:

[0012] In response to a natural language query sent to a large language model, the natural language query is transformed to obtain a query vector;

[0013] From the set of visited nodes, identify the M target nodes whose similarity to the query vector is among the top M, thus obtaining the expanded neighbor node set.

[0014] In one embodiment, determining M target nodes matching the natural language query from the visited node set to obtain the expanded neighbor node set includes:

[0015] Multiple query nodes belonging to different paths are determined from the visited node set. A bundle search is performed according to the multiple query nodes to determine M target nodes that match the natural language query from the visited node set, thus obtaining an expanded neighbor node set.

[0016] In one embodiment, the step of obtaining local PIR protocol auxiliary information, encrypting the local PIR protocol auxiliary information and the batch query list to obtain a target encrypted PIR query message, and sending the target encrypted PIR query message to the server includes:

[0017] Obtain local PIR protocol auxiliary information, encrypt the local PIR protocol auxiliary information and the index of each neighbor node in the batch query list, and obtain the corresponding encrypted PIR query message;

[0018] Multiple encrypted PIR query messages are packaged to obtain a target encrypted PIR query message, and the target encrypted PIR query message is sent to the server.

[0019] In one embodiment, the method further includes:

[0020] Multiple initial entry point vectors are determined from a graph structure constructed from document-based vector data in the server, and a neighbor list for each of the initial entry point vectors is determined from a vector database determined based on the graph structure.

[0021] The set of visited nodes is determined based on multiple initial entry point vectors;

[0022] The nodes of the graph structure are used to represent the vector data, and the vector database includes a combination of each vector data and its corresponding neighbor list. The graph structure is constructed by obtaining a preset document, performing vector processing on the preset document to obtain a vector dataset corresponding to the preset document set, and constructing the vector dataset. The neighbor list is obtained by determining the neighbor nodes of each vector data in the vector dataset based on the graph structure.

[0023] In one embodiment, the method further includes:

[0024] If no target actual vector data matching the natural language query is found in the updated set of visited nodes and the set of expanded neighbor nodes, update the status of the local PIR protocol auxiliary information.

[0025] Obtain the neighbor list corresponding to each node index obtained by decrypting and recovering the encrypted answer using the local PIR protocol auxiliary information;

[0026] Based on the updated set of visited nodes, the updated local PIR protocol auxiliary information, and the neighbor list corresponding to each node index, the step of determining M target nodes that match the natural language query from the set of visited nodes and obtaining the expanded neighbor node set is performed for retrieval iteration until the preset retrieval iteration end condition is met.

[0027] Based on the expanded set of neighboring nodes and the visited set of nodes determined in the last iteration, the target actual vector data that matches the natural language query is determined.

[0028] Secondly, this application also provides a retrieval enhancement generation apparatus, comprising:

[0029] The search seed data determination module is used to obtain search seed data from the server. The search seed data includes an initial entry point vector and a neighbor list corresponding to the initial entry point vector.

[0030] The traversal query module is used to determine the set of visited nodes based on the search seed data, and in response to a natural language query sent for the large language model, to determine M target nodes that match the natural language query from the set of visited nodes, thereby obtaining the set of expanded neighbor nodes.

[0031] Determine the node indexes of all neighbor nodes in the expanded neighbor node set to obtain a batch query list;

[0032] The query module is used to obtain local PIR protocol auxiliary information, encrypt the local PIR protocol auxiliary information and the batch query list to obtain an encrypted PIR query message, and send the encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and the server jointly executing the PIR preprocessing protocol;

[0033] The data recovery module is used to receive the encrypted answer fed back by the server based on the encrypted PIR query message, decrypt and recover the encrypted answer using the local PIR protocol auxiliary information, and obtain the actual vector data corresponding to each node index in the batch query list;

[0034] The enhancement generation module is used to enhance the target actual vector data by means of the large language model if there is target actual vector data in the actual vector data that matches the natural language query, thereby obtaining an enhanced answer.

[0035] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above methods.

[0036] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the above methods.

[0037] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above methods.

[0038] The aforementioned retrieval enhancement generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product achieve local graph matching by maintaining a set of visited nodes locally on the client side. The neighbor node indexes to be expanded are constructed in batches as a query list, which is then encrypted using local PIR protocol auxiliary information generated by the PIR preprocessing protocol. The server executes a private retrieval without decryption and returns the encrypted answer. The client then uses the local PIR protocol auxiliary information to decrypt and obtain the actual vector data, updating the local knowledge subgraph. If the newly obtained data matches the original natural language query, an enhanced answer is generated by a large language model. This ensures that the original query semantics remain on the client side, and the server only receives the encrypted index and cannot infer the user's intent. This blocks the leakage of sensitive information and access patterns caused by plaintext queries in traditional retrieval enhancement generation, achieving information security protection during the retrieval process while maintaining retrieval enhancement generation capabilities. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a diagram illustrating the application environment of the retrieval enhancement generation method in one embodiment;

[0041] Figure 2 This is a flowchart illustrating a retrieval enhancement generation method in one embodiment;

[0042] Figure 3 This is a flowchart illustrating the retrieval enhancement generation method in another embodiment;

[0043] Figure 4 Here is a sequence diagram of the retrieval enhancement generation interaction process in one embodiment;

[0044] Figure 5 This is a schematic diagram illustrating an application scenario of the retrieval enhancement generation method in one embodiment;

[0045] Figure 6 This is a structural block diagram of a retrieval enhancement generation device in one embodiment;

[0046] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0048] The retrieval enhancement generation method provided in this application embodiment can be applied to, for example... Figure 1 The application environment shown depicts a client 102 communicating with a server 104 over a network. A data storage system can store the data that the server 104 needs to process. The data storage system can be integrated onto the server 104, or it can be located in the cloud or on another network server.

[0049] Server 104 performs vector processing on all stored preset documents to obtain a vector dataset corresponding to the preset document set, and constructs a graph structure based on the vector dataset. This graph structure employs a customized graph construction algorithm to ensure that the out-degree (number of neighbors) of each node is regularized (C-out regular) to prevent information leakage from the graph structure. Nodes in the graph structure represent vector data; that is, they represent a vector. Based on the graph structure, all neighbor nodes of each vector data are determined, resulting in a corresponding neighbor list. Each vector data and its corresponding neighbor list are combined to obtain a new vector database. It should be noted that by pre-binding the neighbor list to the vector, the stored neighbor relationships can be directly used to quickly traverse the graph structure during queries, eliminating the need for real-time similarity calculation and significantly reducing search latency.

[0050] A large language model is deployed on client 102. Client 102 can download vector data of several randomly selected initial entry points and their neighbor lists from server 104 in advance as initial seed data, so that client 102 can perform approximate nearest neighbor search on the client side when sending natural language queries to the large language model. In response to a natural language query sent to the large language model, client 102 determines M target nodes matching the natural language query from the visited node set, obtaining an expanded neighbor node set; it obtains a list of neighbors for each visited node, determines the neighbor node index of each node in the expanded neighbor node set from the neighbor list, obtaining a batch query list; it obtains local PIR protocol auxiliary information, encrypts the local PIR protocol auxiliary information and the batch query list, obtaining an encrypted PIR query message, and sends the encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and server collaboratively executing the PIR preprocessing protocol; it receives the encrypted answer from the server based on the encrypted PIR query message, decrypts and recovers the encrypted answer using the local PIR protocol auxiliary information, obtains the actual vector data corresponding to each node index in the batch query list, and updates the visited node set; if the updated visited node set and expanded neighbor node set contain target actual vector data matching the natural language query, the target actual vector data is enhanced using the large language model to obtain an enhanced answer.

[0051] The client 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, etc. The server 104 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.

[0052] In one exemplary embodiment, such as Figure 2 As shown, a retrieval enhancement generation method is provided, which can be applied to... Figure 1 Taking the client as an example, the explanation includes the following steps 202 to 206. Wherein:

[0053] Step 202: In response to a natural language query sent to the large language model, determine M target nodes that match the natural language query from the set of visited nodes to obtain an expanded neighbor node set; wherein, the set of visited nodes is determined based on the graph structure built on the document in the server, and each visited node in the set of visited nodes is used to represent vector data.

[0054] The construction method of the document-based graph structure on the server can be based on existing methods. For example, an optimized graph structure G can be constructed first based on the vector database DB={v1,v2,...,vn} corresponding to all documents of the remote knowledge base server. Each vector vi and its neighbor list N(i) are combined into a new vector database DB'={(vi, N(i))}. The neighbor list N(i) includes the neighbor node indexes corresponding to multiple neighbor nodes. It should be noted that each node in the graph structure in this embodiment has the same number of outgoing edges (C-out regular). The purpose is to eliminate the difference in the number of connections between nodes, so that it is impossible to infer the attributes of a node (such as whether it is a node in a dense area) based on the number of its neighbors, thereby avoiding the exposure of document distribution characteristics or importance levels. This structured privacy construction method can embed privacy protection strategies in the graph index construction stage, making it impossible for attackers to infer sensitive information from the statistical characteristics of the graph structure, while maintaining the basic function of approximate nearest neighbor search.

[0055] For example, the client downloads several initial entry vectors and a list of neighbors corresponding to each vector from the graph structure determined by the server, serving as initial seed data for the search. Before performing the search, the client initializes the set of visited nodes and the set of expanded neighbor nodes based on the acquired initial entry vectors. The initial state of the expanded neighbor node set can be empty. Furthermore, the selection of the initial entry vectors can be determined by, but is not limited to, a fast-start optimization strategy. Optimization strategy: To start quickly and reduce the total number of hops, a small number of representative vectors (e.g., O(sqrt(N)) can be pre-downloaded or locally cached, where N represents the total number of vectors in the graph structure and sqrt represents the square root, which can quickly determine a good starting point at the beginning of the search and reduce the total number of hops.

[0056] In response to a natural language query sent to a large language model, the P-ANN module (as a retrieval tool) in the client performs an approximate nearest neighbor search on the client side. It identifies M target nodes matching the natural language query from the visited node set and moves these M target nodes to an initialized expanded neighbor set, resulting in an expanded neighbor set. The M target nodes can be the top-M graph nodes in the visited node set with the top-M semantic matching degree to the natural language query, serving as the starting point for local expansion and constructing the next neighbor range to be retrieved.

[0057] For example, the client downloads multiple randomly selected initial entry point vectors from the server and simultaneously obtains the neighbor lists of these entry points. These entry point vectors and their neighbor lists are cached locally on the client. The visited node set `visited` is initialized based on the initial entry point vectors. These initial entry point vectors are sorted according to their distance to the natural language query (such as Euclidean distance or cosine similarity) to form a priority queue arranged in ascending order of distance (e.g., nodes with smaller distances have higher priority). Before the search begins, all entry points have not been expanded, and the expanded neighbor node set `developed` is empty.

[0058] Step 204: Obtain the list of neighbors corresponding to each visited node, determine the neighbor node index of each node in the expanded neighbor node set from the neighbor list, and obtain the batch query list.

[0059] The neighbor list can be a list of neighbor node indices associated with each node in the graph structure. A neighbor node index can be a unique identifier in the neighbor list pointing to other graph nodes, and can be used as input for PIR queries to locate the corresponding actual vector data in the server. The batch query list can be a sequence of batch query identifiers composed of multiple neighbor node indices. Furthermore, if a neighbor node index in the batch query list also exists in the expanded neighbor node set and the visited node set, then the duplicate neighbor node indices in the batch query list are removed.

[0060] Step 206: Obtain local PIR protocol auxiliary information, encrypt the batch query list based on the local PIR protocol auxiliary information to obtain the target encrypted PIR query message, and send the target encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and server jointly executing the PIR preprocessing protocol.

[0061] The local PIR protocol auxiliary information can be auxiliary information (e.g., a key) negotiated between the client and server through a PIR preprocessing protocol. This information can be used to encrypt the query list and decrypt the encrypted answers returned by the server, ensuring query privacy. It's important to note that this approach uses Private Information Retrieval (PIR) technology to achieve Approximate Nearest Neighbor (ANN) search. By introducing a client-preprocessed PIR protocol, which performs expensive, one-time or infrequent preprocessing before the query phase, it generates the auxiliary information required by the client. During the actual query phase, the client uses this auxiliary information to initiate a private query to the remote knowledge base. This mechanism prevents the knowledge base from knowing which specific indexes or data the client actually requested, and also prevents it from inferring the user's query intent from access patterns. This method significantly reduces the linear computation / communication cost of traditional PIR to sublinear levels, solving the efficiency bottleneck commonly found in complex, ANN searches.

[0062] Encrypted PIR query messages can be ciphertext messages formed by encrypting a batch query list using local PIR protocol auxiliary information. These messages can be used to request corresponding vector data from the server without revealing the query index. The server can be a remote service entity that hosts a graph-structured knowledge base and supports PIR responses. It can receive encrypted PIR query messages, perform private searches without decryption, and return encrypted answers.

[0063] Step 208: Receive the encrypted answer from the server based on the target encrypted PIR query message, decrypt and recover the encrypted answer using local PIR protocol auxiliary information, obtain the actual vector data corresponding to each node index in the batch query list, and update the set of visited nodes.

[0064] The encrypted answer can be a set of encrypted vector data returned by the server after retrieving the target encrypted PIR query message in the graph structure. It can be used to carry the vector data required by the client but not cached locally, as well as the neighbor list corresponding to each node index in the batch query list, and protect the privacy of the content in ciphertext form.

[0065] For example, the receiving server returns the encrypted answer based on the encrypted PIR query message. Using local PIR protocol auxiliary information, the encrypted answer is decrypted and recovered to obtain the actual vector data corresponding to each node index in the batch query list. The nodes corresponding to each node index in the batch query list are then updated to the visited node set. It should be noted that after determining M target nodes, the M target nodes are removed from the visited node set. In this case, updating the visited node set according to the nodes corresponding to each node index in the batch query list refers to updating the visited node set after removing the M target nodes.

[0066] Step 210: If the updated set of visited nodes and the set of expanded neighbor nodes contain target actual vector data that matches the natural language query, then the target actual vector data is augmented using a large language model to obtain an enhanced answer.

[0067] The target actual vector data can be knowledge vectors successfully decrypted from the server, matching the semantics of the natural language query. These vectors can be used as external knowledge input for the large language model to generate enhanced answers. The number of target actual vector data can be multiple, for example, K vectors (i.e., document chunks). The enhanced answer can be the final response text generated by the large language model after fusing the target actual vector data. This text can be used to provide users with accurate natural language answers based on external knowledge.

[0068] Furthermore, if the updated set of visited nodes and the expanded set of neighbor nodes do not contain the target actual vector data that matches the natural language query, an iterative search needs to be performed locally on the client until the preset retrieval iteration termination condition is met to determine the target actual vector data. It should be noted that the implementation principle of each iterative search is the same, and will not be elaborated upon here.

[0069] The aforementioned retrieval enhancement generation method determines M target nodes from the visited node set in response to natural language queries sent to a large language model, and extracts neighbor node indices from the neighbor list to form a batch query list. It encrypts the batch query list using local PIR protocol auxiliary information and sends it to the server. It receives and decrypts the encrypted answer returned by the server to obtain the actual vector data and updates the visited node set. Upon successful matching, it generates an enhanced answer using the large language model. This method only requires maintaining the visited node set locally on the client side to achieve local graph matching, constructing the neighbor node indices to be expanded into a query list in batches, and utilizing PIR... The local PIR protocol auxiliary information generated by the preprocessing protocol encrypts the list. The server performs a private search without decryption and returns an encrypted answer. The client then uses the local PIR protocol auxiliary information to decrypt and obtain the actual vector data and update the local knowledge subgraph. If the newly obtained data matches the original natural language query, it is handed over to the large language model to generate an enhanced answer. This ensures that the original query semantics are always retained on the client, and the server only receives the encrypted index and cannot infer the user's intent. This blocks the leakage path of sensitive information and access patterns caused by plaintext queries in traditional search enhancement generation, and achieves information security protection of the search process while maintaining the search enhancement generation capability.

[0070] In an exemplary embodiment, in response to a natural language query sent to a large language model, M target nodes matching the natural language query are determined from the visited node set, resulting in an expanded neighbor node set, including:

[0071] In response to a natural language query sent to a large language model, the natural language query is transformed to obtain a query vector; the M target nodes with the highest similarity to the query vector are determined from the visited node set to obtain the expanded neighbor node set.

[0072] The methods for transforming natural language queries to obtain query vectors can be, but are not limited to, one or more of the following: vectorization based on embedding models, extraction based on the internal representation of large language models, and projection based on dedicated query encoders. These will not be elaborated upon here.

[0073] Understandably, the M target nodes can be determined by a bundle search of the visited node set based on a single path or multiple paths. Although the visited node set only includes the initial entry vector and does not explicitly store path information, the client simultaneously downloads several randomly selected initial entry point vectors and their neighbor lists from the server, preserving the topological relationships in the graph structure. These topological relationships still define the paths. In other words, different nodes in the visited node set may belong to path branches extending from different entry points.

[0074] Determining the M target nodes can be achieved by calculating the similarity between the query vector and all node vectors in the visited node set, and selecting the M nodes with the highest scores to form the target set. For example, this can be done by traversing all node vectors, calculating the similarity, and then sorting them, or by using an Approximate Nearest Neighbor (ANN) index to accelerate Top-M retrieval.

[0075] In the above embodiments, the similarity between the query vector and the node vector is calculated based on the set of visited nodes set locally on the client to filter out the top M target nodes, construct an expanded set of neighboring nodes, determine the batch query list for retrieval, and can effectively prevent the leakage of the user's query intent.

[0076] Furthermore, to improve search efficiency and accuracy, multiple paths can be explored simultaneously in each iteration (i.e., multiple nodes can be queried concurrently). In an exemplary embodiment, determining M target nodes matching the natural language query from the visited node set to obtain an expanded neighbor node set includes: determining multiple query nodes belonging to different paths from the visited node set, performing a beam search on the multiple query nodes, and determining the M target nodes matching the natural language query from the visited node set to obtain the expanded neighbor node set. The beam search can be a single-path search or a multi-path search.

[0077] In an exemplary embodiment, obtaining local PIR protocol auxiliary information, encrypting the local PIR protocol auxiliary information and the batch query list to obtain a target encrypted PIR query message, and sending the target encrypted PIR query message to the server includes: obtaining local PIR protocol auxiliary information, encrypting the local PIR protocol auxiliary information and the index of each neighbor node in the batch query list to obtain their respective encrypted PIR query messages; packaging multiple encrypted PIR query messages to obtain the target encrypted PIR query message, and sending the target encrypted PIR query message to the server.

[0078] It is understandable that obtaining local PIR protocol auxiliary information, encrypting the local PIR protocol auxiliary information and each batch query list to obtain multiple encrypted PIR query messages can be achieved by reusing the same local PIR protocol auxiliary information for each batch query list, performing independent PIR encryption operations, and generating an encrypted PIR query message corresponding to each neighbor node index. The method of packaging multiple encrypted PIR query messages can be done using existing methods, which will not be elaborated here.

[0079] In the above embodiments, by packaging multiple PIR queries in a single iteration into a batch, the communication volume and computational overhead of each query can be significantly reduced, especially under large-scale data volumes.

[0080] Understandably, in client-side local graph traversal, a single iteration is often insufficient to determine the actual target vector data that matches the natural language query, thus requiring multiple iterations.

[0081] In an exemplary embodiment, the above-described retrieval enhancement generation method further includes: if no target actual vector data matching the natural language query exists in the updated visited node set and the expanded neighbor node set, updating the state of the local PIR protocol auxiliary information; obtaining the neighbor list corresponding to each node index obtained by decrypting and recovering the encrypted answer using the local PIR protocol auxiliary information; performing retrieval iteration based on the updated visited node set, the updated local PIR protocol auxiliary information, and the neighbor list corresponding to each node index, performing the step of determining M target nodes matching the natural language query from the visited node set to obtain the expanded neighbor node set, until a preset retrieval iteration termination condition is met; and determining the target actual vector data matching the natural language query based on the expanded neighbor node set and the visited node set determined in the last iteration.

[0082] The updated local PIR protocol auxiliary information can be a new version of the original local PIR protocol auxiliary information, refreshed or with parameters evolved based on session state or security policy during the retrieval iteration process. This can be used to prevent cross-round queries from being correlated and to enhance privacy in multi-round interactions. For example, state refresh can be achieved by deriving new random numbers or updating key-derived parameters. The server stores a neighbor list corresponding to each vector. The neighbor list corresponding to each node index can be determined from the set of adjacency indices associated with the nodes corresponding to the newly decrypted actual vector data in the server graph structure. The neighbor list corresponding to each node index can be used to provide new expansion boundaries for the next round of retrieval. Preset retrieval iteration termination conditions may include, but are not limited to, a maximum iteration round threshold, or the relevance of newly added nodes being lower than a set threshold.

[0083] In the above embodiments, if the updated set of visited nodes and the expanded set of neighbor nodes do not contain target actual vector data matching the natural language query, the state of the local PIR protocol auxiliary information is updated. The neighbor lists corresponding to each node index, obtained by decrypting and recovering the encrypted answer using the local PIR protocol auxiliary information, are retrieved iteratively until a preset retrieval iteration end condition is met. The target actual vector data matching the natural language query is determined based on the expanded set of neighbor nodes and the set of visited nodes determined in the last iteration. This method, through PIR technology, ensures that the remote knowledge base service provider cannot know the specific content, query index, and access mode of the user's query, thereby eliminating the risk of privacy leakage in the traditional RAG model. Furthermore, the graph-based ANN search algorithm, combined with client-side preprocessing of PIR, reduces the linear computation / communication cost of traditional PIR to sublinear. In addition, under the premise of privacy protection, it can achieve search quality similar to non-privacy ANN algorithms, ensuring the accuracy of the question answers in the RAG system.

[0084] It's important to note that during the actual query phase, the client initiates a private query to the remote knowledge base using local PIR protocol auxiliary information. This mechanism prevents the knowledge base from knowing which specific indexes or data the client actually requested, nor can it infer the user's query intent from access patterns, when responding to the client's query. Therefore, the client only caches a portion of the graph structure on the server, while the remote knowledge base server stores a large amount of document data and builds corresponding dense vector indexes (e.g., graph structures).

[0085] In an exemplary embodiment, the method further includes: determining a plurality of initial entry point vectors from a graph structure constructed from document-based vector data in a server, and determining a neighbor list for each initial entry point vector from a vector database determined based on the graph structure; determining a set of visited nodes based on the plurality of initial entry point vectors; wherein the nodes of the graph structure are used to represent the vector data, and the vector database includes a combination of each vector data and its corresponding neighbor list;

[0086] The graph structure is constructed by obtaining a preset document, performing vector processing on the preset document to obtain a vector dataset corresponding to the preset document set, and then constructing the neighbor list based on the vector dataset; the neighbor list is obtained by determining the neighbor nodes of each vector data in the vector dataset based on the graph structure.

[0087] The graph structure built on the document-based vector data in the server can be a graph topology constructed by the server after vectorizing the preset documents, using vector data as nodes and semantic or structural proximity relationships as edges. This topology can be used to provide clients with a traversable knowledge index structure, supporting PIR retrieval by node index. In an exemplary embodiment, the graph structure built on the document-based vector data in the server can include, but is not limited to, one or more of the following: k-nearest neighbor graph (k-NNGraph), semantic clustering graph, and document paragraph connection graph.

[0088] Multiple initial entry point vectors can be a representative set of node vectors selected from the server graph structure, serving as the initial starting point for the client's locally visited node set, and can be used to construct a non-empty initial visited node set. The neighbor list of each initial entry point vector can be a set of indices of directly connected neighboring nodes in the graph structure for each initial entry point vector, and can be used to expand the initial visited node set.

[0089] The visited node set can be a client-locally initialized node set consisting of multiple initial entry point vectors, built before formally responding to a natural language query. Nodes in a graph structure can be the basic units within the graph structure, with each node corresponding to a vector data set. This vector data can be a dense numerical vector obtained by embedding a predefined document or its fragments into an embedding model; it can be used to represent the semantic content of the document and to construct graph structure nodes and for subsequent similarity matching. The neighbor list can be a record of the indices of directly connected neighbor nodes for each node, traversed through the graph structure.

[0090] In the above embodiments, the client can perform local matching on the first query and use local PIR protocol auxiliary information to initiate a private query to the remote knowledge base. This makes it impossible for the server to know which specific indexes or data the client actually requested when responding to the client's query, nor can it infer the user's query intent from the access pattern, thus improving data security.

[0091] In one exemplary embodiment, such as Figure 3 As shown, a retrieval enhancement generation method is provided, which can be applied to... Figure 1 The following is an explanation using a client-side example:

[0092] Step 1: Build the graph structure corresponding to the preset document on the server;

[0093] Step 2: The client generates local PIR protocol auxiliary information;

[0094] Step 3: In response to a natural language query sent to the large language model, perform a privacy-preserving RAG query;

[0095] Step 4: The client performs an iterative search locally to construct the target encrypted PIR query message;

[0096] Step 5: Send the target encrypted PIR query message to the server;

[0097] Step 6: Decrypt and recover the encrypted answer returned by the server;

[0098] Step 7: Does the target actual vector data match the natural language query? If it does, proceed to step 8; otherwise, proceed to step 4 until the target actual vector data is determined.

[0099] Step 8: The large language model performs augmentation processing on the target actual vector data.

[0100] It should be noted that the specific implementation steps of this example can be achieved in the manner described above, and will not be elaborated here.

[0101] For example, the remote knowledge base server first constructs an optimized graph structure G for its vector database DB={v1, v2,..., vn} corresponding to all documents. The server combines each vector vi and its neighbor list N(i) into a new database DB' ={(vi, N(i))}. The client and server collaboratively execute a PIR preprocessing protocol. In this stage, the client and server interactively perform preprocessing to generate auxiliary information required for the PIR protocol locally, obtaining local PIR protocol auxiliary information. This process may involve significant computation and communication overhead, but it typically only needs to be performed once or updated infrequently.

[0102] The client simultaneously downloads several randomly selected initial entry point vectors and their neighbor lists from the server. In response to natural language queries sent to the large language model, the natural language query is transformed to obtain a query vector. The P-ANN module in the client initializes the visited node set (visited) and the expanded neighbor node set (developed) based on the query vector. The initialized visited node set includes a list of nodes that have been visited and whose information has been obtained, and a priority queue is constructed based on their distance from the query vector.

[0103] In each "hop" iteration, the P-ANN module selects M nodes from the visited list that are closest to the query vector q and moves them to the developed list. The P-ANN module collects the indexes of all the neighbors of these M nodes, forming a batch query list. At the same time, indexes that are already in the visited or developed lists are removed from this batch to avoid duplicate queries.

[0104] The batch query list is encrypted based on local PIR protocol auxiliary information to obtain the target encrypted PIR query message. The target encrypted PIR query message is sent to the server. The encrypted answer fed back by the server based on the target encrypted PIR query message is received. The encrypted answer is decrypted and recovered using local PIR protocol auxiliary information to obtain the actual vector data corresponding to each node index in the batch query list and the neighbor list. The set of visited nodes is then updated.

[0105] If the updated set of visited nodes and the expanded set of neighbor nodes contain target actual vector data that matches the natural language query, then the target actual vector data is augmented using the large language model to obtain an enhanced answer. If not, the iteration continues, and the above process iterates for a preset maximum number of hops H or until a satisfactory neighbor is found. After each iteration, the new neighbor is added to the visited set. Finally, the P-ANN module selects the K target actual vector data that are closest to q from the visited and developed sets, and the retrieved K target actual vector data are sent back to the LLM. The LLM combines this contextual information to generate an enhanced answer to the user query. In the above embodiment, by introducing the client-side preprocessing PIR protocol, the client uses this auxiliary information to initiate a private query to the remote knowledge base during the actual query phase. This mechanism prevents the knowledge base from knowing which specific indexes or data the client actually requested when responding to the client's query, and also prevents it from inferring the user's query intent from the access pattern. This fundamentally solves the problem of privacy leakage of user query content and access patterns in the RAG system, making it impossible for external knowledge bases to know what information the user retrieved, greatly enhancing the privacy and security of the system. Meanwhile, compared to pure cryptographic methods (such as fully homomorphic encryption), online query efficiency is significantly improved in scenarios involving large-scale vector data and efficient iterative queries. It can support real-time privacy retrieval of large-scale knowledge bases with billions of vectors, achieving a balance between privacy and efficiency.

[0106] When a user enters a query, the large language model first performs vectorization processing, and then retrieves the most relevant text fragments or their vector representations from a remote knowledge base in a privacy-preserving manner through the P-ANN module. These privately retrieved search results are then sent back to the LLM to enhance its generation process. This ensures that the knowledge retrieval process is completely transparent to external service providers throughout the entire process from initiating a query to receiving the final answer, guaranteeing the privacy of the user's query throughout the entire chain.

[0107] In one exemplary embodiment, such as Figure 4As shown, a sequence diagram of a retrieval enhancement generation interaction process is provided, including a client (LLM computing domain) and a server (service provider side), comprising an access point server and a data provider (remote knowledge base). The access point server acts as a bridge between the user / LLM and the remote knowledge base, internally containing a core privacy-preserving approximate nearest neighbor search (P-ANN) module responsible for handling privacy-preserving retrieval logic. The remote knowledge base stores a large amount of document data and constructs corresponding dense vector indexes (e.g., graph structures). The client deploys a large language model (LLM) and a privacy-preserving ANN module (P-ANN). The LLM computing domain can be flexibly deployed in an executable environment (TEE), a user's local device / all-in-one machine, or a cloud server, etc.

[0108] During the initialization phase, the remote knowledge base undergoes knowledge base preprocessing, constructing an optimized graph structure / encrypted vector index, including the original vector data and the neighbor list corresponding to each original vector data. In the privacy information retrieval preprocessing phase, the client and server collaborate on negotiation and data transmission, streaming the original vector data and the neighbor list corresponding to each original vector data to generate PIR protocol auxiliary information. The client saves the local PIR protocol auxiliary information and downloads the initial entry point to support rapid startup optimization. The encrypted vector index refers to a vector index structure stored in a certain encrypted or obfuscated manner in privacy-preserving approximate nearest neighbor search, such as the graph structure constructed on the server side.

[0109] In response to a natural language query sent to the large language model, the natural language query is transformed to obtain a query vector. The client performs graph traversal and privacy retrieval iterations locally based on the query volume until the preset retrieval iteration termination condition is met. Finally, the target actual vector data that matches the natural language query is determined, and the target actual vector data is enhanced through the large language model to obtain an enhanced answer.

[0110] The implementation steps for each retrieval include: determining M target nodes matching the natural language query from the visited node set; obtaining the neighbor list corresponding to each visited node; determining the neighbor node index of each node in the expanded neighbor node set from the neighbor list to obtain a batch query list; encrypting the batch query list based on local PIR protocol auxiliary information to obtain a target encrypted PIR query message; sending the target encrypted PIR query message to the server, where the server cannot obtain the specific data queried or the access pattern; receiving the encrypted answer from the server based on the target encrypted PIR query message, which is generated by executing the PIR protocol; decrypting and recovering the encrypted answer using local PIR protocol auxiliary information to obtain the actual vector data corresponding to each node index in the batch query list; and updating the visited node set and the status of the local PIR protocol auxiliary information.

[0111] In one exemplary embodiment, such as Figure 5 The diagram illustrates an application scenario for the retrieval enhancement generation method, including: Responding to a natural language query sent to a large language model: "How is XXX's capability building in the trusted data space and large model?", the TEE computing domain parses this query to obtain the progress of XXX's trusted data space construction, the technical capabilities of XXX's large language model, and the technical architecture of XXX's data space. The parsing results are vectorized to obtain the corresponding query vector. Based on this query vector, a dense-state approximate vector search and a high-performance anonymous ensemble query are performed on the server to obtain a summary of retrieval results. The summary of retrieval results is then enhanced based on the large language model to obtain an enhanced answer. The specific implementation of determining the summary of retrieval results based on the dense-state approximate vector search and the high-performance anonymous ensemble query can be achieved through the method for determining the actual target vector data described above, and will not be elaborated here. The server can include multiple remote knowledge bases supporting the P-ANN protocol to achieve concurrent or serial privacy queries. By aggregating retrieval results from different knowledge bases, LLM can generate more comprehensive and multi-source answers. These different knowledge bases can include payment company document databases, AI company document databases, and data center document databases.

[0112] In the above embodiments, Private Information Retrieval (PIR) technology ensures that the remote knowledge base service provider cannot know the specific content, query index, and access pattern of the user's query, thereby eliminating the risk of privacy leakage in the traditional RAG model. A graph-based ANN search algorithm is employed, combined with client-side preprocessing of PIR, reducing the linear computation / communication cost of traditional PIR to sublinear (e.g., O(sqrt(N))) and incorporating multiple optimization strategies (bundle search, fast startup, batch query). This makes it possible to achieve millisecond-to-second online query latency on large-scale knowledge bases (such as hundreds of millions of vectors), far superior to other strong privacy technologies. Under the premise of privacy protection, it can achieve search quality similar to non-privacy ANN algorithms, ensuring the accuracy of question answers in the RAG system. In addition, it solves the privacy compliance challenges faced by enterprises when sharing and utilizing sensitive internal or cross-enterprise knowledge, enabling data to flow with value while protecting privacy, and providing a secure foundation for AI applications in fields such as group companies, financial institutions, healthcare, and law. The deployment of the LLM computing domain can be flexibly selected in a Trusted Execution Environment (TEE), user local devices, or general cloud, adapting to different security levels and deployment scenarios, reducing the technical threshold and cost of implementation. Since the core privacy protection logic is implemented based on cryptographic primitives, the trust assumptions of the knowledge base service provider are reduced to a minimum (only trust in their fulfillment of the agreement is required), enhancing the robustness of the system.

[0113] In addition, a beam search mechanism is employed to improve search efficiency and accuracy; a fast starting strategy is used to accelerate query starting point location; and multiple PIR requests are aggregated through batched query technology to reduce overall communication and computational overhead. Furthermore, when constructing its vector index, the remote knowledge base uses a customized graph structure to better adapt to privacy protection requirements and improve retrieval performance.

[0114] It should be noted that, for any of the above embodiments, in responding to natural language queries, multiple remote knowledge bases supporting the P-ANN protocol can be connected simultaneously to perform privacy queries concurrently or sequentially. By aggregating search results from different knowledge bases, LLM can generate more comprehensive and multi-source answers.

[0115] For scenarios with limited network connectivity or insufficient client storage space, it is advisable to have a trusted third-party service (or private cloud environment) complete most of the client preprocessing work, and then transmit the final lightweight PIR auxiliary information to the end user client, thereby reducing the local preprocessing cost on the client.

[0116] If the LLM is deployed in a TEE, the user's original prompt, query vector, and retrieved sensitive document content can be processed within the TEE, further ensuring that this data is not accessed or leaked by external systems (including the host machine), thus achieving end-to-end protection of the user's prompt.

[0117] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0118] Based on the same inventive concept, this application also provides a retrieval enhancement generation apparatus for implementing the retrieval enhancement generation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more retrieval enhancement generation apparatus embodiments provided below can be found in the limitations of the retrieval enhancement generation method described above, and will not be repeated here.

[0119] In one exemplary embodiment, such as Figure 6 As shown, a retrieval enhancement generation device is provided, comprising: a traversal module 602, a batch query list determination module 604, an encryption module 606, a data recovery module 608, and an enhancement generation module 610, wherein:

[0120] Traversal module 602 is used to respond to natural language queries sent to a large language model, determine M target nodes that match the natural language query from the set of visited nodes, and obtain an expanded set of neighbor nodes; wherein, the set of visited nodes is determined according to the graph structure built based on documents in the server, and each visited node in the set of visited nodes is used to represent vector data.

[0121] The batch query list determination module 604 is used to obtain the list of neighbors corresponding to each visited node, determine the neighbor node index of each node in the expanded neighbor node set from the neighbor list, and obtain the batch query list.

[0122] The encryption module 606 is used to obtain local PIR protocol auxiliary information, encrypt the batch query list based on the local PIR protocol auxiliary information to obtain the target encrypted PIR query message, and send the target encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and server jointly executing the PIR preprocessing protocol.

[0123] The data recovery module 608 is used to receive the encrypted answer fed back by the server based on the target encrypted PIR query message, decrypt and recover the encrypted answer using local PIR protocol auxiliary information, obtain the actual vector data corresponding to each node index in the batch query list, and update the set of visited nodes.

[0124] The enhancement generation module 610 is used to enhance the target actual vector data through a large language model if the updated set of visited nodes and the set of expanded neighbor nodes contain target actual vector data that matches the natural language query, thereby obtaining an enhanced answer.

[0125] The aforementioned retrieval enhancement generation device achieves local graph matching by maintaining a set of visited nodes locally on the client side. It constructs a query list in batches of neighbor node indexes to be expanded and encrypts this list using local PIR protocol auxiliary information generated by the PIR preprocessing protocol. The server executes a private retrieval without decryption and returns the encrypted answer. The client then uses the local PIR protocol auxiliary information to decrypt and obtain the actual vector data, updating the local knowledge subgraph. If the newly obtained data matches the original natural language query, it is handed over to the large language model to generate an enhanced answer. This ensures that the original query semantics remain on the client side, and the server only receives the encrypted index and cannot infer the user's intent. This blocks the leakage of sensitive information and access patterns caused by plaintext queries in traditional retrieval enhancement generation, achieving information security protection during the retrieval process while maintaining retrieval enhancement generation capabilities.

[0126] In an exemplary embodiment, the traversal module 602 is used to transform the natural language query in response to a natural language query sent for a large language model to obtain a query vector.

[0127] From the set of visited nodes, identify the M target nodes that have the highest similarity to the query vector, and obtain the expanded neighbor node set.

[0128] In an exemplary embodiment, the traversal module 602 is used to determine multiple query nodes belonging to different paths from the visited node set, perform a bundle search according to the multiple query nodes, determine M target nodes that match the natural language query from the visited node set, and obtain the expanded neighbor node set.

[0129] In an exemplary embodiment, the encryption module 606 is used to obtain local PIR protocol auxiliary information, encrypt the local PIR protocol auxiliary information and the index of each neighbor node in the batch query list, and obtain the corresponding encrypted PIR query message.

[0130] Multiple encrypted PIR query messages are packaged to obtain the target encrypted PIR query message, which is then sent to the server.

[0131] In an exemplary embodiment, the above apparatus further includes a privacy information retrieval preprocessing module, configured to determine multiple initial entry point vectors from a graph structure constructed from document-based vector data in the server, and to determine a neighbor list for each initial entry point vector from a vector database determined based on the graph structure; and to determine a set of visited nodes based on the multiple initial entry point vectors.

[0132] In this context, the nodes of the graph structure are used to represent vector data, and the vector database includes a combination of each vector data and its corresponding neighbor list. The graph structure is constructed by obtaining a preset document, performing vector processing on the preset document, and obtaining a vector dataset corresponding to the preset document set. The neighbor list is obtained by determining the neighbor nodes of each vector data in the vector dataset based on the graph structure.

[0133] In an exemplary embodiment, the above apparatus further includes an iteration module, configured to update the status of the local PIR protocol auxiliary information if no target actual vector data matching the natural language query exists in the updated set of visited nodes and the set of expanded neighbor nodes.

[0134] Obtain the list of neighbors corresponding to each node index obtained by decrypting and recovering the encrypted answer using local PIR protocol auxiliary information;

[0135] Based on the updated set of visited nodes, the updated local PIR protocol auxiliary information, and the neighbor list corresponding to each node index, the search iteration continues until the preset end condition is met.

[0136] Each module in the aforementioned search enhancement generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0137] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a retrieval-enhanced generation method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0138] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0139] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0140] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0141] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0143] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0144] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0145] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A retrieval enhancement generation method, characterized in that, Applied to a client, the method includes: In response to a natural language query sent to a large language model, M target nodes matching the natural language query are determined from the set of visited nodes to obtain an expanded set of neighbor nodes; wherein, the set of visited nodes is determined based on a graph structure built on documents in the server, and each visited node in the set of visited nodes is used to represent vector data. Obtain the list of neighbors corresponding to each of the visited nodes, determine the neighbor node index of each node in the expanded neighbor node set from the neighbor list, and obtain the batch query list; Obtain local PIR protocol auxiliary information, encrypt the batch query list based on the local PIR protocol auxiliary information to obtain a target encrypted PIR query message, and send the target encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and the server jointly executing the PIR preprocessing protocol; The system receives the encrypted answer from the server based on the target encrypted PIR query message, decrypts and recovers the encrypted answer using the local PIR protocol auxiliary information, obtains the actual vector data corresponding to each node index in the batch query list, and updates the set of visited nodes. If the updated set of visited nodes and the set of expanded neighbor nodes contain target actual vector data that matches the natural language query, then the target actual vector data is augmented using the large language model to obtain an enhanced answer.

2. The method according to claim 1, characterized in that, In response to a natural language query sent to a large language model, M target nodes matching the natural language query are determined from the visited node set, resulting in an expanded neighbor node set, including: In response to a natural language query sent to a large language model, the natural language query is transformed to obtain a query vector; From the set of visited nodes, identify the M target nodes whose similarity to the query vector is among the top M, thus obtaining the expanded neighbor node set.

3. The method according to claim 1, characterized in that, The step of determining M target nodes that match the natural language query from the visited node set to obtain the expanded neighbor node set includes: Multiple query nodes belonging to different paths are determined from the visited node set. A bundle search is performed according to the multiple query nodes to determine M target nodes that match the natural language query from the visited node set, thus obtaining an expanded neighbor node set.

4. The method according to claim 3, characterized in that, The step of obtaining local PIR protocol auxiliary information, encrypting the local PIR protocol auxiliary information and the batch query list to obtain a target encrypted PIR query message, and sending the target encrypted PIR query message to the server includes: Obtain local PIR protocol auxiliary information, encrypt the local PIR protocol auxiliary information and the index of each neighbor node in the batch query list, and obtain the corresponding encrypted PIR query message; Multiple encrypted PIR query messages are packaged to obtain a target encrypted PIR query message, and the target encrypted PIR query message is sent to the server.

5. The method according to claim 1, characterized in that, The method further includes: Multiple initial entry point vectors are determined from a graph structure constructed from document-based vector data in the server, and a neighbor list for each of the initial entry point vectors is determined from a vector database determined based on the graph structure. The set of visited nodes is determined based on multiple initial entry point vectors; The nodes of the graph structure are used to represent the vector data, and the vector database includes a combination of each vector data and its corresponding neighbor list. The graph structure is constructed by obtaining a preset document, performing vector processing on the preset document to obtain a vector dataset corresponding to the preset document set, and constructing the vector dataset. The neighbor list is obtained by determining the neighbor nodes of each vector data in the vector dataset based on the graph structure.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: If no target actual vector data matching the natural language query is found in the updated set of visited nodes and the set of expanded neighbor nodes, update the status of the local PIR protocol auxiliary information. Obtain the neighbor list corresponding to each node index obtained by decrypting and recovering the encrypted answer using the local PIR protocol auxiliary information; Based on the updated set of visited nodes, the updated local PIR protocol auxiliary information, and the neighbor list corresponding to each node index, the step of determining M target nodes that match the natural language query from the set of visited nodes and obtaining the expanded neighbor node set is performed for retrieval iteration until the preset retrieval iteration end condition is met. Based on the expanded set of neighboring nodes and the visited set of nodes determined in the last iteration, the target actual vector data that matches the natural language query is determined.

7. A retrieval enhancement generation device, characterized in that, The device includes: The traversal module is used to respond to a natural language query sent to a large language model, determine M target nodes that match the natural language query from the set of visited nodes, and obtain an expanded neighbor node set; wherein, the set of visited nodes is determined according to the graph structure built based on documents in the server, and each visited node in the set of visited nodes is used to represent vector data. The batch query list determination module is used to obtain the neighbor list corresponding to each of the visited nodes, determine the neighbor node index of each node in the expanded neighbor node set from the neighbor list, and obtain the batch query list. An encryption module is used to obtain local PIR protocol auxiliary information, encrypt the batch query list based on the local PIR protocol auxiliary information to obtain a target encrypted PIR query message, and send the target encrypted PIR query message to the server; the local PIR protocol auxiliary information is generated by the client and the server jointly executing the PIR preprocessing protocol; The data recovery module is used to receive the encrypted answer fed back by the server based on the target encrypted PIR query message, decrypt and recover the encrypted answer using the local PIR protocol auxiliary information, obtain the actual vector data corresponding to each node index in the batch query list, and update the set of visited nodes. The enhancement generation module is used to enhance the target actual vector data by means of the large language model if there is target actual vector data that matches the natural language query in the updated set of visited nodes and the set of expanded neighbor nodes, thereby obtaining an enhanced answer.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.