Vector retrieval method, device and equipment and readable storage medium
By asynchronously performing I/O operations and candidate vector pool updates in graph structure vector index retrieval, the problem of solid-state drive retrieval delay is solved, and the retrieval efficiency and performance are improved.
Patent Information
- Application Number
- CN202510606770.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-26
AI Technical Summary
The existing solid-state hard disk-based graph structure vector index search method is affected by high I/O delay and storage medium delay fluctuations, resulting in low search delay and inefficiency, and cannot effectively utilize the performance of I/O pipelines.
By maintaining and managing I/O operations in the executed state during the search process, asynchronously performing the reading and distance calculation of neighbor vector nodes and candidate vector pool updates, decoupling the I/O operations and candidate vector pool updates, and dynamically schedule I/O tasks to improve pipeline utilization.
The impact of I/O delay on retrieval efficiency is reduced, the efficiency and performance of vector retrieval is improved, and the potential of I/O pipeline is fully utilized.
Smart Images

Figure CN120541275A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information processing technology, and in particular to a vector retrieval method, apparatus, device, and readable storage medium. Background Art
[0002] In the process of quickly and accurately retrieving vectors similar to the target vector from vector data, the vector retrieval method based on graph-structured vector indexing can effectively utilize the similarity relationship between vectors and demonstrates good performance in large-scale high-dimensional vector retrieval tasks.
[0003] Currently, in vector retrieval scenarios where graph-structured vector indexes are stored on storage media such as solid-state drives (SSDs), due to their advantages such as fast read and write speeds, low latency, and good shock resistance, existing retrieval algorithms, such as greedy algorithms, are partially mismatched with the high I / O latency and parallel pipeline I / O hardware characteristics of storage media such as SSDs. The retrieval process is easily affected by I / O operation delays and latency fluctuations of the storage media itself, resulting in extremely high retrieval delays and affecting retrieval efficiency. Summary of the Invention
[0004] In view of this, in order to solve the above technical problems, the present application provides a vector retrieval method, apparatus, device and readable storage medium.
[0005] Specifically, this application is implemented through the following technical solutions:
[0006] According to a first aspect of an embodiment of the present application, a vector search method is provided, the method comprising:
[0007] In the process of retrieving a target vector based on a graph structure vector index in a storage medium, if the number of input / output (I / O) operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited, initiating an I / O operation on the node to be visited, and changing the state of the node to be visited to an explored vector node; wherein the I / O operation is used to read each neighbor vector node of the node to be visited from the graph structure vector index stored in the storage medium;
[0008] When any I / O operation is completed, the distance between each neighbor vector node returned by the I / O operation and the target vector is determined, and the candidate vector pool is updated based on the distance between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
[0009] Optionally, the method further includes:
[0010] In response to completion of any I / O operation, determining a proportion of nodes in the candidate vector pool that existed at the time of completion of the I / O operation among the to-be-accessed nodes targeted by the historical I / O operation; wherein the historical I / O operation includes all completed I / O operations from the start of the search to the completion of the I / O operation;
[0011] Based on the node ratio being greater than a set threshold, the upper limit threshold of the I / O operation quantity is adjusted.
[0012] Optionally, determining the proportion of nodes in the candidate vector pool that exist in the to-be-accessed nodes targeted by the historical I / O operation when the I / O operation is completed includes:
[0013] In response to the completion of any I / O operation, adding the to-be-visited node targeted by the completed I / O operation to a first node list, and storing all vector nodes in the candidate vector pool at the time of completion of the I / O operation into a second node list; wherein the first node list is used to store the to-be-visited nodes targeted by the historical I / O operation;
[0014] Determining common elements between the first node list and the second node list, and counting the sum of the number of occurrences of each of the common elements in the first node list to obtain an existence count;
[0015] The node ratio is obtained based on the number of existences and the number of nodes in the first node list.
[0016] Optionally, determining the proportion of nodes in the candidate vector pool that exist in the to-be-accessed nodes targeted by the historical I / O operation when the I / O operation is completed includes:
[0017] In response to the completion of any I / O operation, it is detected whether the node to be accessed targeted by the completed I / O operation exists in the candidate vector pool at the time when the I / O operation is completed:
[0018] If yes, then update the number of nodes in the candidate vector pool plus one and the total number of nodes plus one; if no, then update the total number of nodes plus one;
[0019] The node ratio is obtained based on the updated number of nodes in the candidate vector pool and the total number of nodes.
[0020] Optionally, the method further includes:
[0021] Constructing an I / O operation set, wherein the I / O operation set is used to record I / O operations in an execution state;
[0022] After initiating the I / O operation for the node to be accessed, recording the initiated I / O operation in the I / O operation set, and detecting whether the number of I / O operations currently in execution is lower than a preset I / O operation number upper threshold;
[0023] In response to detecting that any I / O operation is completed, the completed I / O operation is removed from the I / O operation set, and the number of I / O operations currently in execution is triggered to be lower than a preset I / O operation number upper threshold.
[0024] Optionally, when any I / O operation is completed, determining the distance between each neighbor vector node returned by the I / O operation and the target vector includes:
[0025] In response to completion of any I / O operation, the node to be accessed targeted by the completed I / O operation and each neighbor vector node of the node to be accessed that has been read are cached in a set of nodes to be processed;
[0026] According to the cache order of each to-be-visited node in the to-be-processed node set, the distance between each neighbor vector node of each to-be-visited node and the target vector is determined.
[0027] Optionally, when the number of I / O operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from the candidate vector pool as the node to be visited includes:
[0028] In response to the number of I / O operations currently being executed being lower than the upper limit threshold of the number of I / O operations, determining whether there is an unexplored vector node in the candidate vector pool;
[0029] If it exists, the unexplored vector node closest to the target vector is selected from the candidate vector pool as the node to be visited;
[0030] If not: when both the I / O operation set and the set of nodes to be processed are empty, generating a search result for the target vector based on the vector nodes included in the candidate vector pool; when at least one of the I / O operation set and the set of nodes to be processed is not empty, continuing to determine whether there is an unexplored vector node in the candidate vector pool after the candidate vector pool is updated.
[0031] Optionally, updating the candidate vector pool based on the distance between each neighbor vector node and the target vector includes:
[0032] Based on the existing candidate vector nodes in the candidate vector pool, deduplicating the neighbor vector nodes to obtain deduplicated neighbor vector nodes;
[0033] When the number N of the existing candidate vector nodes is less than L, the (LN) neighbor vector nodes closest to the target vector are selected from the deduplicated neighbor vector nodes, and are merged into the candidate vector pool in ascending order of distance;
[0034] When the number of the existing candidate vector nodes is L, the first node closest to the target vector among the neighboring vector nodes after deduplication is determined, and a check is performed to determine whether the distance corresponding to the first node is greater than the farthest candidate vector node in the candidate vector pool. If so, updating the candidate vector pool is stopped. If not, the farthest candidate vector node is replaced with the first node, and a new first node is re-determined from the neighboring vector nodes other than the first node.
[0035] Optionally, updating the candidate vector pool based on the distance between each neighbor vector node and the target vector includes:
[0036] Merging the neighbor vector nodes with the existing vector nodes stored in the candidate vector pool to remove duplicates, to obtain a deduplicated node set, and sorting the vector nodes in the deduplicated node set in ascending order according to the distance between the vector node and the target vector;
[0037] When the number of nodes in the deduplicated node set is greater than L, the first L vector nodes and their distances to the target vector are used as storage contents of the updated candidate vector pool;
[0038] When the number of nodes in the deduplicated node set is less than or equal to L, all sorted vector nodes and their distances to the target vector are used as storage contents of the updated candidate vector pool.
[0039] According to a second aspect of an embodiment of the present application, a vector search device is provided, the device comprising:
[0040] An I / O operation management module is configured to, during a process of retrieving a target vector based on a graph structure vector index in a storage medium, select, when the number of I / O operations currently in execution is lower than a preset upper threshold for the number of I / O operations, an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited, initiate an I / O operation on the node to be visited, and change the state of the node to be visited to an explored vector node; wherein the I / O operation is configured to read neighboring vector nodes of the node to be visited from the graph structure vector index stored in the storage medium;
[0041] The candidate vector pool updating module is configured to, upon completion of any I / O operation, determine the distance between each neighbor vector node returned by the I / O operation and the target vector, and update the candidate vector pool based on the distance between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
[0042] Optionally, the device further comprises:
[0043] a node ratio calculation module, configured to determine, in response to the completion of any I / O operation, the ratio of nodes in the candidate vector pool of the to-be-accessed nodes targeted by the historical I / O operation that existed at the time the I / O operation was completed; wherein the historical I / O operation includes all completed I / O operations from the start of the search to the completion of the I / O operation;
[0044] The threshold adjustment module is used to adjust the upper limit threshold of the I / O operation quantity based on the node ratio being greater than a set threshold.
[0045] Optionally, the node ratio calculation module is specifically used to:
[0046] In response to the completion of any I / O operation, adding the to-be-visited node targeted by the completed I / O operation to a first node list, and storing all vector nodes in the candidate vector pool at the time of completion of the I / O operation into a second node list; wherein the first node list is used to store the to-be-visited nodes targeted by the historical I / O operation;
[0047] Determining common elements between the first node list and the second node list, and counting the sum of the number of occurrences of each of the common elements in the first node list to obtain an existence count;
[0048] The node ratio is obtained based on the number of existences and the number of nodes in the first node list.
[0049] Optionally, the node ratio calculation module is specifically used to:
[0050] In response to the completion of any I / O operation, it is detected whether the node to be accessed targeted by the completed I / O operation exists in the candidate vector pool at the time when the I / O operation is completed:
[0051] If yes, then update the number of nodes in the candidate vector pool plus one and the total number of nodes plus one; if no, then update the total number of nodes plus one;
[0052] The node ratio is obtained based on the updated number of nodes in the candidate vector pool and the total number of nodes.
[0053] Optionally, the device further comprises:
[0054] Constructing an I / O operation set, wherein the I / O operation set is used to record I / O operations in an execution state;
[0055] After initiating the I / O operation for the node to be accessed, recording the initiated I / O operation in the I / O operation set, and detecting whether the number of I / O operations currently in execution is lower than a preset I / O operation number upper threshold;
[0056] In response to detecting that any I / O operation is completed, the completed I / O operation is removed from the I / O operation set, and the number of I / O operations currently in execution is triggered to be lower than a preset I / O operation number upper threshold.
[0057] Optionally, the candidate vector pool updating module is specifically configured to:
[0058] In response to completion of any I / O operation, the node to be accessed targeted by the completed I / O operation and each neighbor vector node of the node to be accessed that has been read are cached in a set of nodes to be processed;
[0059] According to the cache order of each to-be-visited node in the to-be-processed node set, the distance between each neighbor vector node of each to-be-visited node and the target vector is determined.
[0060] Optionally, the I / O operation management module is specifically configured to:
[0061] In response to the number of I / O operations currently being executed being lower than the upper limit threshold of the number of I / O operations, determining whether there is an unexplored vector node in the candidate vector pool;
[0062] If it exists, the unexplored vector node closest to the target vector is selected from the candidate vector pool as the node to be visited;
[0063] If not: when both the I / O operation set and the set of nodes to be processed are empty, generating a search result for the target vector based on the vector nodes included in the candidate vector pool; when at least one of the I / O operation set and the set of nodes to be processed is not empty, continuing to determine whether there is an unexplored vector node in the candidate vector pool after the candidate vector pool is updated.
[0064] Optionally, the candidate vector pool updating module is specifically configured to:
[0065] Based on the existing candidate vector nodes in the candidate vector pool, deduplicating the neighbor vector nodes to obtain deduplicated neighbor vector nodes;
[0066] When the number N of the existing candidate vector nodes is less than L, the (LN) neighbor vector nodes closest to the target vector are selected from the deduplicated neighbor vector nodes, and are merged into the candidate vector pool in ascending order of distance;
[0067] When the number of the existing candidate vector nodes is L, the first node closest to the target vector among the neighboring vector nodes after deduplication is determined, and a check is performed to determine whether the distance corresponding to the first node is greater than the farthest candidate vector node in the candidate vector pool. If so, updating the candidate vector pool is stopped. If not, the farthest candidate vector node is replaced with the first node, and a new first node is re-determined from the neighboring vector nodes other than the first node.
[0068] Optionally, the candidate vector pool updating module is specifically configured to:
[0069] Merging the neighbor vector nodes with the existing vector nodes stored in the candidate vector pool to remove duplicates, to obtain a deduplicated node set, and sorting the vector nodes in the deduplicated node set in ascending order according to the distance between the vector node and the target vector;
[0070] When the number of nodes in the deduplicated node set is greater than L, the first L vector nodes and their distances to the target vector are used as storage contents of the updated candidate vector pool;
[0071] When the number of nodes in the deduplicated node set is less than or equal to L, all sorted vector nodes and their distances to the target vector are used as storage contents of the updated candidate vector pool.
[0072] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a memory and a processor; the memory is used to store a computer program; and the processor is used to execute the above-mentioned vector retrieval method by calling the computer program.
[0073] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the above-mentioned vector retrieval method is implemented.
[0074] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0075] In the technical solution provided in the present application, by maintaining and managing the I / O operations in execution state for reading neighbor vector nodes of a specified vector node from a storage medium during the retrieval process, the process of reading neighbor vector nodes of the asynchronously executed I / O operations is decoupled from the distance calculation based on the neighbor vector nodes and the candidate vector pool update process, thereby reducing the sequential dependency between search steps and giving full play to the I / O pipeline performance, thereby reducing the impact of I / O delay on retrieval efficiency and improving retrieval efficiency.
[0076] It should be understood that the above general description and the detailed description below are merely exemplary and explanatory and cannot limit the present application. In addition, any embodiment in the present application does not necessarily achieve all the effects described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0078] Figure 1A This is a schematic diagram of a graph structure vector index and storage medium storage shown in an exemplary embodiment of the present application;
[0079] Figure 1B This is a flow chart of a vector search method according to an exemplary embodiment of the present application;
[0080] Figure 1C 1 is a schematic diagram illustrating a graph structure vector index and initiating an I / O operation and updating a candidate vector pool for the graph structure vector index according to an exemplary embodiment of the present application;
[0081] Figure 2 This is a schematic diagram of calculating the node ratio when an I / O operation is completed, shown in an exemplary embodiment of the present application;
[0082] Figure 3 This is a schematic diagram of element changes in an I / O operation set shown in an exemplary embodiment of the present application;
[0083] Figure 4 This is a schematic diagram of a process of caching I / O operation return results into a collection for sequential consumption, as shown in an exemplary embodiment of the present application;
[0084] Figure 5 This is an interactive flow chart illustrating an exemplary embodiment of the present application for initiating a new I / O operation when an I / O pipeline is idle;
[0085] Figure 6 is a structural diagram of a vector search device shown in an exemplary embodiment of the present application;
[0086] Figure 7 It is a hardware schematic diagram of an electronic device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0087] Here, exemplary embodiments will be described in detail, with examples shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Instead, they are merely examples of devices and methods consistent with certain aspects of this application as detailed in the appended claims. It should be understood that although the terms first, second, third, etc. may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
[0088] High-dimensional vector data has been widely used in many fields such as image retrieval, natural language processing, and recommendation systems. In the process of quickly and accurately retrieving vectors similar to the target vector from massive high-dimensional vector data, vector retrieval methods based on graph-structured vector indexing can effectively utilize the similarity relationship between vectors and demonstrate good performance in large-scale high-dimensional vector retrieval tasks.
[0089] In existing graph-based vector retrieval processes, such as the greedy algorithm, a candidate vector pool of maximum length L is maintained to store the current node to be accessed. At the start of the retrieval process, the candidate vector pool contains only a few given entry points from the graph structure vector index. The retrieval process is divided into several steps. In each step, W vector nodes closest to the target vector are selected from the candidate vector pool. These vector nodes' neighboring vectors are read from the graph structure vector index through I / O (Input / Output Operation) operations and added to the candidate pool. The distances between these neighboring vector nodes and the target vector are then calculated, and the vectors in the candidate pool are sorted based on these calculated distances.
[0090] With the continuous advancement of storage technology, solid-state drives (SSDs) and other storage media have gradually become the preferred choice for large-scale data storage due to their advantages such as fast read and write speeds, low latency, and good shock resistance. In vector retrieval scenarios where graph-structured vector indexes are stored on storage media, existing retrieval methods such as greedy algorithms or those based on candidate vector pools and extended searches for neighboring vector nodes are not compatible with the high I / O latency and parallel pipeline I / O hardware characteristics of storage media such as SSDs, resulting in extremely high retrieval latency.
[0091] On the one hand, there is a data sequence dependency chain between each step of the algorithm, that is, the next step of vector I / O operation depends on the vector distance calculation and candidate pool update results of the previous step, that is, the calculation and sorting of the vector distances in the current candidate pool must be completed before the vector to be read in the next step can be determined; and the vector distance calculation process of each step is also dependent on the vector I / O operation of the current step. Only after the relevant vectors are successfully read can subsequent processing such as distance calculation be performed.
[0092] For example, suppose that the maximum length L=3 of the candidate vector pool of the TOP-3 nodes closest to the target vector Q is required to be found in the graph structure vector index data. In the initial state, the candidate vector pool includes the set node A. The graph structure vector index stored on the known storage medium is:
[0093] A's neighbors: {B, C}; B's neighbors: {A, D}; C's neighbors: {A, E}; D's neighbors: {B, F}; E's neighbors: {C, G}; F's neighbors: ... (other nodes omitted);
[0094] Assume that the distances between each node and Q are: A:5.0, B:4.2, C:6.1, D:3.8, E:5.5, F:3.0, G:7.0. These distances are calculated after the neighbor vector nodes are read by the I / O operation.
[0095] For the above example, in the process of retrieving Q from the graph structure vector index using the approximate nearest neighbor retrieval method, the serial execution process of the I / O operation is as follows:
[0096] (1) Candidate vector pool {A},
[0097] Initiate I / O operation OP1 for A and return {B, C};
[0098] Calculate the distance between A, B, C and Q and update the candidate vector pool to obtain {B, A, C};
[0099] (2) B is the closest in the current pool and has not explored its neighbors,
[0100] Initiate I / O operation OP2 for B and return {A, D};
[0101] Calculate the distance between D and Q and update the candidate vector pool to obtain {D, B, A};
[0102] (3) D is the closest in the current pool and its neighbors have not been explored,
[0103] Initiate I / O operation OP3 for D and return {B, F};
[0104] Calculate the distance between F and Q and update the candidate vector pool to obtain {F, D, B};
[0105] …
[0106] This shows that during the target vector retrieval process based on the graph structure vector index on the storage medium, I / O operations are triggered serially. The next step of reading the vector through the I / O operation must wait for the distance calculation and candidate vector pool update results of the previous step. In turn, the distance calculation and candidate vector pool of each step must wait for the vector result read through the I / O operation in the current step, forming a strong coupling and sequential dependency chain between distance calculation and I / O operation. This serialized retrieval process is susceptible to the delay of I / O operations and the delay fluctuations of the storage medium itself. Each operation must wait for the completion of the previous operation before it can begin, which greatly amplifies the impact of I / O delay on retrieval performance, resulting in a significant increase in retrieval delay and low retrieval efficiency.
[0107] On the other hand, in order to improve the utilization rate of the I / O pipeline, some retrieval methods in related technologies will use parallel I / O operations to synchronously read multiple vectors in each step. However, in actual applications, the latency of the storage medium itself fluctuates, and the time required for reading operations on different vectors may vary greatly. When a slow I / O operation request occurs, the entire parallel reading process will be forced to wait for the slowest I / O operation request to complete, resulting in other I / O operation requests that have completed reading not being processed in time. The I / O pipeline is in an idle waiting state, with low utilization efficiency, resulting in excessive retrieval latency.
[0108] In view of this, to solve the above problems, the present application provides a vector retrieval method suitable for the above-mentioned retrieval of target vectors based on graph-structured vector indexes on storage media (such as approximate nearest neighbor retrieval based on graph-structured vector indexes), and suitable for efficient retrieval scenarios of large-scale vector data sets. In this vector retrieval method, during the retrieval process, the I / O operations in execution for reading neighbor vector nodes of a specified vector node from a storage medium are maintained and managed, and the process of reading neighbor vector nodes of the asynchronously executed I / O operations is decoupled from the distance calculation based on the neighbor vector nodes and the candidate vector pool update process, thereby reducing the sequential dependency between search steps and giving full play to the I / O pipeline performance, thereby reducing the impact of I / O latency on retrieval efficiency and improving retrieval efficiency.
[0109] A graph-structured vector index represents vector data organized by a graph-based vector index. It organizes all vectors into a graph for storage. In the graph structure, each vector node represents a vector, and vector nodes are connected by edges. Edges can represent certain relationships between vectors, such as distance relationships. This graph structure facilitates efficient vector retrieval. A storage medium represents a physical device used to store data, such as a hard disk drive (HDD), solid-state drive (SSD), or magnetic tape. In the vector retrieval scenario described in this application, the graph-structured vector index data is stored on the storage medium.
[0110] See also Figure 1A A schematic diagram illustrating a graph-structured vector index and storage medium storage is shown. Each node in the diagram represents a vector, and the node value represents the vector number. The graph-structured vector index is split into several records and stored on a storage medium such as a solid-state drive. For example, each record stored in the illustrated storage method includes the numbers of a vector node and its neighboring vector nodes. This application does not limit the storage method for the graph-structured vector index; for example, the vector and its neighbor numbers can also be split and stored separately.
[0111] Based on the graph vector structure stored in the storage medium, in the process of retrieving the TOP-K vectors that are most similar to the target vector, see Figure 1B The vector retrieval method provided in this application may include at least the following steps:
[0112] S101, in a process of retrieving a target vector based on a graph structure vector index in a storage medium, if the number of I / O operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from a candidate vector pool as a to-be-visited node, initiating an I / O operation on the to-be-visited node, and changing the state of the to-be-visited node to an explored vector node;
[0113] The target vector represents the vector to be searched, for example, it can be a query vector input by the user, or a vector that needs to be matched in an application task.
[0114] The candidate vector pool represents a vector set maintained during the retrieval of the target vector, and is used to store the top L candidate vector nodes that are most similar to the target vector and are gradually screened during the retrieval process. The candidate vector nodes in the candidate vector pool are continuously updated as the retrieval process progresses. The candidate vector pool can be initialized by including several specified vector nodes in the graph structure vector index; alternatively, the candidate vector pool can be initialized by selecting several nodes using the InMemSearch method based on some key vector nodes in the pre-loaded graph structure vector index. This application does not limit the initialization of the candidate vector pool.
[0115] The candidate vector pool may store only candidate vector nodes and store the distances between the candidate vector nodes and the target vector separately in a mapping relationship or other manner; alternatively, the candidate vector nodes and the distances between the candidate vector nodes and the target vector may be stored simultaneously to facilitate fast distance comparison when updating the candidate vector pool.
[0116] Neighbor vector nodes represent other vector nodes directly connected to the unexplored vector node in the graph structure vector index. Figure 1A Taking the graph structure vector index shown in the figure as an example, the neighbor vector nodes of vector node 1 include nodes 0, 2, 3, and 5. By accessing the neighbor vector nodes, the search range can be further expanded to find vectors that are closer to the target vector.
[0117] Unexplored vector nodes represent candidate vector nodes in the candidate vector pool that have not yet been explored by their neighboring vector nodes in the graph vector index. Graph-based vector retrieval uses a strategy of gradually approaching the target vector. During the retrieval process, the vector node closest to the target vector is selected from the candidate vector pool. I / O operations are then initiated for the selected node to perform processes such as neighbor node access and distance calculation. As a result, the candidate vector pool will contain both explored and unexplored vector nodes.
[0118] An I / O operation represents the process of exchanging data between a computer and an external device, such as a storage medium. In this embodiment, the I / O operation is used to read the neighboring vector nodes of the node to be accessed, targeted by the I / O operation, from a graph structure vector index stored in the storage medium. When the candidate vector pool is maintained in memory, this I / O operation represents data exchange between the memory and the storage medium.
[0119] The preset upper limit threshold for the number of I / O operations is used to indicate the maximum number of I / O operations that the system supports being executed simultaneously within a specific time period. For example, if the upper limit threshold for the number of I / O operations is set to 4, it means that the system supports a maximum of 4 I / O operations being executed within a period of time. In this embodiment, the upper limit threshold for the number of I / O operations can be initialized to a fixed value. For example, the upper limit threshold for the number of I / O operations can be the same as the number of candidate vector nodes included in the initialized candidate vector pool. As the retrieval process proceeds, the upper limit threshold for the number of I / O operations can be dynamically adjusted at appropriate times to adapt to the specific retrieval situation and improve retrieval efficiency. For details, please refer to the subsequent embodiments.
[0120] In the retrieval process of this embodiment, I / O operations in the execution state are maintained and managed, continuously monitoring whether the number of I / O operations in the execution state is lower than the upper threshold of the I / O operation quantity. If so, it indicates that the current I / O operation pipeline has not reached the full-load state, and there is idle I / O operation resources, so I / O operations can be continuously called to improve the I / O utilization rate during the vector retrieval process.
[0121] Therefore, when the number of I / O operations in the execution state is lower than the upper threshold of the I / O operation quantity, for all candidate vector nodes stored in the candidate vector pool, after filtering out the explored vector nodes, select the nearest unexplored vector node to the target vector to be retrieved as the node to be accessed, and initiate an I / O operation for this node to be accessed to obtain the neighbor vector nodes of this node to be accessed. Initiating an I / O operation involves interacting with the storage medium driver, sending the I / O operation request to the storage medium, and waiting for the storage medium to return data.
[0122] For the node to be accessed for which an I / O operation has been initiated, since it has used the I / O operation to obtain the neighbor vector nodes, in order not to affect the selection process of subsequent nodes to be accessed, the state of this node to be accessed can be changed to an explored node after initiating the I / O operation for this node to be accessed.
[0123] After initiating the I / O operation for this node to be accessed, continue to monitor the number of I / O operations in the execution state. If there is still a situation where the number is lower than the upper threshold of the I / O operation quantity, the above steps can be repeated to continue to determine a new node to be accessed and initiate an I / O operation again.
[0124] For example, taking Figure 1C the graph-structured vector index shown as an example, this graph-structured vector index is split into several records and stored in the storage medium. The red-pointed node in the graph is the target vector V to be retrieved. Assume that in the initial state: the candidate vector pool PL = {J: 4, M: 5.8, T: 6, I: 6.5}, all are unexplored vector nodes, the maximum length L of the candidate vector pool is 6, the upper threshold W0 of the I / O operation quantity is 3, and the number W of I / O operations in the execution state at the beginning is 0. Then:
[0125] (1) The number W of I / O operations in the execution state < W0. Select the nearest unexplored vector node J to the target vector V from the candidate vector pool PL, initiate an I / O operation OP1 for J, and W = 1;
[0126] (2) The number W of I / O operations in the execution state < W0. Continue to select the nearest unexplored vector node M to V from PL, initiate an I / O operation OP3 for M, and W = 2;
[0127] (3) The number of I / O operations W in the execution state is less than W0. Continue to select the un-explored vector node T closest to V from the PL, initiate an I / O operation OP2 for T, and W = 3;
[0128] At this time, if the number of I / O operations W in the execution state is equal to W0, then no further I / O operations for the un-explored vector nodes in the candidate vector pool will be initiated. Among them, the I / O operation OP1 for J is used to obtain the neighbor vector nodes of node J in the graph structure vector index. Similarly, OP2 and OP3 are respectively used to obtain the neighbor vector nodes of nodes M and T.
[0129] S102. When any I / O operation is completed, determine the distances between each of the neighbor vector nodes returned by this I / O operation and the target vector, and update the candidate vector pool based on the distances between each of these neighbor vector nodes and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
[0130] The I / O operation described in this embodiment is an asynchronously executed I / O operation, that is, it allows the program to continue executing other tasks after initiating an I / O request without waiting for the I / O operation to complete. When the I / O operation is completed, the program will obtain the return result of the I / O operation through a certain method such as a callback function, event notification, or Future / Promise object and perform subsequent processing.
[0131] When an I / O operation initiated for an un-explored vector node (i.e., a node to be visited) in the candidate vector pool is completed, the neighbor vector nodes adjacent to this un-explored vector node in the graph structure vector index can be obtained. For example, taking Figure 1C the un-explored vector node J as an example, when OP1 is completed, the neighbor vector nodes I, B, and K of J are obtained.
[0132] For each of the neighbor vector nodes adjacent to this un-explored vector node returned by this I / O operation, calculate the distance between each neighbor vector node and the target vector. This distance is used to measure the similarity or difference between two vectors, and this distance metric can be determined by methods such as Euclidean distance, cosine similarity, etc. For example, for Figure 1C the neighbor vector nodes I, B, and K of the un-explored vector node J, calculate the distances between nodes I, B, and K and the target vector V respectively, and obtain the corresponding distances such as (I: 6.5; B: 0.8; K: 3).
[0133] The vector retrieval based on the graph structure adopts a strategy of gradually approaching the target vector. By accessing the neighbor vector nodes, the retrieval range is further expanded to find a vector closer to the target vector. Therefore, after obtaining the distances between each neighbor vector node of the unexplored vector nodes and the target vector, based on the distances from the target vector, the distances of each obtained neighbor vector node are compared with the existing candidate vector nodes in the candidate vector pool, so that at most L vector nodes with the shortest distances to the target vector among each neighbor vector node and the existing candidate vector nodes in the candidate vector pool are stored in the updated candidate vector pool.
[0134] When updating the candidate vector pool, after deduplicating each neighbor vector node based on the existing candidate vector nodes in the candidate vector pool, the update can be performed based on whether the number of existing candidate vector nodes in the candidate vector pool before update is less than the maximum length of the candidate vector pool:
[0135] (1) If the number N of existing candidate vector nodes in the candidate vector pool before update is less than L, then select the (L - N) neighbor vector nodes with the shortest distances to the target vector from the deduplicated neighbor vector nodes and merge them into the candidate vector pool in ascending order of distance. For example, taking the aforementioned candidate vector pool PL = {J: 4, M: 5.8, T: 6, I: 6.5} as an example, the distances between the neighbor vector nodes of J returned by OP1 and the target vector V are (I: 6.5; B: 0.8; K: 3). Given that the maximum length L of the candidate vector pool is 6 and the number N of existing candidate vector nodes in PL currently is 4 < L, therefore, directly select 2 neighbor vector nodes B and K with the shortest distances to the target vector from the deduplicated neighbor vector nodes (B: 0.8; K: 3) and add them to the candidate vector pool. The updated PL = {B: 0.8, K: 3, J: 4, M: 5.8, T: 6, I: 6.5}.
[0136] (2) If the number of existing candidate vector nodes in the candidate vector pool before update is L, then determine the first node with the shortest distance to the target vector among the deduplicated neighbor vector nodes, and detect whether the distance corresponding to this first node is greater than the candidate vector node with the farthest distance in the candidate vector pool, that is, compare the neighbor vector node with the shortest distance to the target vector among the deduplicated neighbor vector nodes with the candidate vector node with the farthest distance in the candidate vector pool:
[0137] If the distance of the neighbor vector node with the shortest distance to the target vector among the neighbor vector nodes (i.e., the first node) is greater, then stop updating the candidate vector pool; otherwise, that is, the distance of the neighbor vector node with the shortest distance to the target vector is less than or equal to the candidate vector node with the farthest distance in the candidate vector pool, then replace the candidate vector node with the farthest distance in the candidate pool with the neighbor vector node with the shortest distance to the target vector, and repeat the above process until the update of the candidate vector pool stops.
[0138] For example, the candidate vector pool PL after being updated using the neighbor vector node of J returned by OP1 is PL = {B: 0.8, K: 3, J: 4, M: 5.8, T: 6, I: 6.5}. If the distance between the neighbor vector node of M returned by OP2 and V is (E: 1.5, F: 3.2), then when PL is updated again using the neighbor vector node of M, based on the fact that the neighbor vector node E is closer than the candidate vector node I already in the candidate vector pool, E is merged into the candidate vector pool and I is removed. Similarly, F is merged into the candidate vector pool and T is removed. The updated candidate vector pool PL = {B: 0.8, E: 1.5, K: 3, F: 3.2, J: 4, M: 5.8}.
[0139] In the disclosed embodiment, by decoupling the asynchronous I / O operation from the computation process and dynamically maintaining the candidate vector pool, the retrieval process is optimized and the impact of I / O delay on retrieval efficiency is reduced. During the retrieval process, by monitoring the number of I / O operations currently in execution, when it is lower than a preset threshold, the unexplored vector node closest to the target vector is selected from the candidate vector pool to initiate the I / O operation, thereby achieving dynamic scheduling of I / O tasks and efficient utilization of resources. At the same time, by decoupling the reading process of the asynchronous I / O operation from the distance calculation based on the neighbor vector node and the candidate vector pool update process, the sequential dependency between the search steps is reduced, so that the I / O operation and the computation task can be executed in parallel, thereby giving full play to the performance of the I / O pipeline. In addition, by dynamically updating the candidate vector pool based on the distance between the neighbor vector node and the target vector, it is ensured that the candidate vector pool always stores at most L vector nodes closest to the target vector, providing a high-quality candidate set for subsequent retrieval steps. This method effectively reduces the impact of I / O delay on retrieval efficiency and improves the overall performance and response speed of vector retrieval.
[0140] In some embodiments, based on in-depth observation and analysis of the I / O pipeline efficiency and search stage characteristics, the applicant found that in the vector search process, there are significant differences in the impact and efficiency of I / O operations at different stages on the retrieval results: in the early stage of the search, the distance between the candidate vector nodes in the candidate vector pool and the target vector is relatively large. At this time, exploring too many vectors at the same time may not significantly improve the retrieval efficiency, but may lead to resource waste due to excessive I / O operations; as the search progresses, the candidate vector nodes in the candidate vector pool gradually approach the target vector. At the stage when the search is about to end and the k nearest neighbor vectors need to be recalled from around the target vector, most of the candidate vector nodes in the candidate pool are potential neighbors of the target vector. At this time, exploring the candidate vector nodes at the same time is equivalent to verifying them. Since these vectors are already very close to the target vector, this verification wastes less resources and helps to quickly determine the final k nearest neighbor results.
[0141] Based on this, to further optimize the efficiency of the I / O pipeline, this embodiment proposes a method for dynamically adjusting the I / O pipeline width (i.e., the upper threshold of the number of I / O operations). The core idea of this method is to evaluate the changes in vectors in the candidate vector pool during the search process and dynamically adjust the upper threshold of the number of I / O operations to ensure search efficiency. This method can be implemented through the following steps a1-a2:
[0142] a1. In response to the completion of any I / O operation, determine the proportion of nodes in the candidate vector pool that existed at the time of completion of the historical I / O operation, among the nodes to be accessed targeted by the historical I / O operation; wherein the historical I / O operation includes all completed I / O operations from the start of the search to the completion of the I / O operation;
[0143] The historical I / O operations include the currently completed I / O operations. A data structure such as a list or a queue may be maintained to record all completed I / O operations from the start of the retrieval to the current moment.
[0144] This node ratio can be expressed as (number of second nodes / total number of to-be-visited nodes targeted by historical I / O operations), where the number of second nodes represents the number of nodes included in the candidate vector pool at the time the I / O operation is completed that are to-be-visited nodes targeted by the historical I / O operations. To calculate this node ratio, after each I / O operation is completed, all to-be-visited nodes targeted by the historical I / O operations are traversed, and each to-be-visited node is checked to see if it exists in the candidate vector pool at the time the I / O operation is completed. The node ratio is calculated by calculating the ratio of the number of to-be-visited nodes in the candidate vector pool to the total number of to-be-visited nodes.
[0145] The node ratio indicates the stability of candidate vector nodes in the candidate vector pool, reflecting the search progress for the target vector. A high node ratio indicates a high probability that previously explored nodes remain in the current candidate pool, and node updates in the candidate vector pool are stable. A low node ratio indicates frequent node turnover in the candidate pool.
[0146] For example, the aforementioned Figure 1CTaking the I / O operation OP3 shown as an example, when OP3 is completed, the historical I / O operation represents all completed I / O operations from the time the target vector is retrieved to the time OP3 is completed, namely OP1-OP3. Since OP1 is initiated for node J, and similarly OP2 and OP3 are initiated for nodes M and T, respectively, the nodes to be accessed by the historical I / O operations are (J, M, T). Assuming that the candidate vector pool has been updated twice using the neighbor vector nodes returned by OP1 and OP2 before OP3 is completed, the candidate vector pool when OP3 is completed is PL = {B: 0.8, E: 1.5, K: 3, F: 3.2, J: 4, M: 5.8} after the update using OP2.
[0147] Based on this, the number of the second nodes mentioned above represents the number of nodes in (J, M, T) that still exist in the candidate vector pool PL = {B: 0.8, E: 1.5, K: 3, F: 3.2, J: 4, M: 5.8} after OP3 is executed. Since J and M still exist in the candidate vector pool, the number of second nodes is 2, and the corresponding node ratio after OP3 is executed is 2 / 3;
[0148] a2. Based on the node ratio being greater than a set threshold, adjust the upper limit threshold of the I / O operation quantity.
[0149] Since the node ratio can be used to evaluate the closeness between the vectors in the candidate vector pool and the target vector in the current retrieval phase, a threshold can be set as a decision basis to measure whether the node updates in the candidate vector pool tend to be stable. When the node ratio is greater than the set threshold, it means that there is a high probability that the historically explored nodes remain in the current candidate pool, and the node updates in the candidate vector pool tend to be stable, which can reflect that the vectors in the candidate vector pool in this exploration phase are likely to become potential close vectors to the target vector. It is suitable to increase the upper limit threshold of the number of I / O operations to accelerate the verification process and determine the final k-nearest neighbor results as soon as possible, thereby realizing dynamic adjustment of the I / O pipeline width.
[0150] Regarding adjusting the upper limit threshold of the number of I / O operations based on the node ratio being greater than the set threshold, the upper limit threshold of the number of I / O operations may be increased by one when the corresponding node ratio is greater than the set threshold when a single I / O operation is completed; or, based on the random contingency of a single node ratio being higher than the set threshold, the upper limit threshold of the number of I / O operations may be increased by one when the corresponding node ratios are all greater than the set threshold when n consecutive I / O operations are completed, e.g., n is 2.
[0151] In this embodiment, the node ratio itself is used to evaluate the proximity of vectors in the candidate vector pool to the target vector. The purpose of setting the threshold is also to locate the stage where the search is about to end so as to increase the I / O pipeline to simultaneously explore candidate vector nodes and accelerate the search process. Therefore, calculating the node ratio in the early stage of the search when the number of vectors in the candidate vector pool is small is of limited significance. Moreover, due to the small number of I / O operations and the small cardinality, the node ratio is easily inflated, which leads to excessively increasing the number of I / O operations in the early stage of the search and causing resource waste. Therefore, the node ratio corresponding to the completion of the above-mentioned I / O operation can be temporarily not calculated in the early stage of the search. Optionally, in response to the completion of any I / O operation, if the number of historical I / O operations is greater than the maximum width L of the candidate pool vector, the node ratio of the candidate vector pool at the time of the completion of the I / O operation is determined. By delaying the calculation of the node ratio, it is possible to avoid premature adjustment of the I / O pipeline width in the early stage of the search, thereby improving the overall efficiency of the algorithm.
[0152] In the disclosed embodiment, by evaluating changes in vectors in the candidate vector pool during the retrieval process and dynamically adjusting the I / O pipeline width (i.e., the upper threshold for the number of I / O operations), the parallelism of I / O operations can be increased near the end of the search, optimizing resource utilization, accelerating the verification process, and determining the final retrieval results as quickly as possible, thereby reducing retrieval time and improving overall retrieval efficiency.
[0153] In some embodiments, in order to efficiently and accurately calculate the proportion of nodes in the candidate vector pool at the completion of the I / O operation among the to-be-accessed nodes targeted by historical I / O operations, and to reduce computational complexity, this embodiment proposes a method for quickly calculating the node proportion by finding the intersection of list elements, with respect to the above-mentioned process of determining the proportion of nodes in the candidate vector pool at the completion of the I / O operation among the to-be-accessed nodes targeted by historical I / O operations. The core idea is to store the to-be-accessed nodes targeted by historical I / O operations and the vector nodes in the candidate vector pool at the completion of the I / O operation into two lists, respectively, to quickly determine the number of common elements, and then calculate the node proportion. See Figure 2 The node ratio calculation diagram shown in FIG. 1 is performed when the I / O operation is completed. The following steps may be performed:
[0154] S201, in response to the completion of any I / O operation, adding the to-be-accessed node targeted by the completed I / O operation to a first node list, and storing all vector nodes in the candidate vector pool at the time of completion of the I / O operation into a second node list; wherein the first node list is used to store the to-be-accessed nodes targeted by the historical I / O operation;
[0155] This embodiment maintains two lists: a first node list and a second node list. The first node list is used to store the nodes to be accessed for all completed I / O operations from the start of the search to the current moment. That is, the first node list continuously accumulates node vectors without deduplication of elements and is updated upon the completion of each I / O operation, adding the nodes to be accessed for that completed I / O operation. The second node list is used to store all vector nodes in the candidate vector pool upon the completion of a single I / O operation. After the node ratio corresponding to the I / O operation is calculated, it is reinitialized to empty to facilitate the storage of all vector nodes in the candidate vector pool upon the completion of the next I / O operation.
[0156] like Figure 2 As shown, in response to the completion of any I / O operation, the to-be-accessed node targeted by the I / O operation is added to the first node list, and all vector nodes in the current candidate vector pool are stored in the second node list which is currently in an empty set state, that is, the second node list is cleared before the storage to ensure that it contains only the vector nodes in the current candidate vector pool.
[0157] For example, the aforementioned Figure 1C For example, the first node list corresponding to OP2 is {J, M}, and the second node list is the nodes {B, K, J, M, T, I} in the candidate vector pool when OP2 is executed; the first node list corresponding to OP3 is {J, M, T}, and the second node list is the nodes {B, E, K, F, J, M} in the candidate vector pool when OP3 is executed.
[0158] S202: Determine common elements between the first node list and the second node list, and count the sum of the number of occurrences of each of the common elements in the first node list to obtain an existence count;
[0159] By traversing each element in the second node list and checking whether it exists in the first node list, the common elements between the first node list and the second node list can be quickly found with the help of list operation functions. For each common element, the number of times it appears in the first node list is counted, and the number of times these common elements appear in the first node list is added up to get the number of times they exist.
[0160] S203: Obtain the node ratio based on the number of existences and the number of nodes in the first node list.
[0161] Since the number of existences represents the data of the nodes that the to-be-accessed nodes targeted by the historical I / O operations exist in the candidate vector pool when the I / O operations are completed, the node ratio can be expressed as: (number of existences) / (number of nodes in the first node list).
[0162] In the disclosed embodiment, by adding the to-be-accessed node targeted by the completed I / O operation to the first node list and storing all vector nodes in the candidate vector pool at the time the I / O operation is completed in the second node list, the parameters required for calculating node ratios are better maintained and managed, avoiding calculation errors caused by updating the candidate vector pool during the node ratio calculation process. Furthermore, the list-based calculation method can reduce computational complexity and improve computational efficiency.
[0163] The above embodiment provides a method of calculating the full survival status of the candidate vector pool based on the full historical I / O operation of the to-be-accessed node at the time of I / O execution completion, which can comprehensively reflect the changes in the candidate vector nodes in the candidate vector pool. Based on this, in order to promptly reflect local and immediate changes in the survival status of the to-be-accessed node, in some embodiments, the survival status of the candidate vector pool of the to-be-accessed node targeted by a single I / O operation at the time of the I / O execution completion can also be used to determine the proportion of nodes in the candidate vector pool of the to-be-accessed node targeted by the historical I / O operation at the time of the I / O operation completion, that is:
[0164] In response to the completion of any I / O operation, a check is performed to determine whether the to-be-accessed node targeted by the completed I / O operation exists in the candidate vector pool at the time of the completion of the I / O operation. If so, the number of nodes in the candidate vector pool is incremented by one and the total number of nodes is incremented by one. If not, the total number of nodes is incremented by one. Based on the updated number of nodes in the candidate vector pool and the total number of nodes, the node ratio is obtained. The number of nodes in the candidate vector pool and the total number of nodes are both initialized to 0.
[0165] For example, assuming that the nth I / O operation is completed, and the I / O operation is initiated for the unexplored vector node G in the candidate vector pool that is closest to the target vector, if G is still included in the candidate vector pool when the nth I / O operation is completed, then the number of nodes U representing the candidate vector pool is updated to U=U+1, and the total number of nodes changes from (N-1) to N; similarly, when the n+1th I / O operation is completed, if the node to be visited is present in the candidate vector pool when the n+1th I / O operation is completed, then both U and n continue to be increased by one. Conversely, if the node to be visited is not present in the candidate vector pool when the n+1th I / O operation is completed, then only the total number of nodes changes from N to N=N+1, and U remains unchanged.
[0166] When the nth I / O operation is completed, the number of nodes U representing the candidate vector pool is updated to U=U+1, and the total number of nodes will change from (N-1) to N. The node ratio when the I / O operation is completed can be expressed as (U / N).
[0167] In this way, the dynamic changes of the node status in the candidate vector pool can be captured more promptly, and the current candidate vector node adjustment status of the candidate vector pool can be reflected in real time, providing a more accurate and real-time basis for adjusting the parameters of the I / O pipeline width, that is, the upper limit threshold of the number of I / O operations.
[0168] In some embodiments, based on the fact that this application manages the I / O operations used to read from the storage medium in the process of retrieving the TOP-k vector nodes most similar to the target vector from the graph structure vector index data stored in the storage medium, in order to ensure the efficiency of the I / O operations and the stability of the system, it is necessary to manage and schedule the I / O operations in a refined manner. By limiting the number of I / O operations executed simultaneously, it is possible to avoid excessive occupation of system resources and improve the response speed and overall performance of the system. To achieve this goal, an I / O operation set can be constructed to record and manage the I / O operations currently in execution, thereby ensuring that the number of I / O operations in the system remains within a reasonable range at any time. This can be achieved through the following steps b1-b3:
[0169] b1, constructing an I / O operation set, wherein the I / O operation set is used to record I / O operations in execution state;
[0170] like Figure 3 The diagram below shows how to change the elements of an I / O operation set. This creates an I / O operation set, which records the currently executing I / O operations. Maintaining this set allows real-time monitoring and management of I / O operation status. Each element in the I / O operation set represents an executing I / O operation, and the number of elements in the set equals the number of currently executing I / O operations.
[0171] b2, after initiating the I / O operation for the node to be accessed, recording the initiated I / O operation to the I / O operation set, and detecting whether the number of I / O operations currently in execution is lower than a preset I / O operation number upper threshold;
[0172] After initiating an I / O operation for the node to be accessed, the I / O operation will be changed to the execution state, such as Figure 3 As shown, the I / O operation can be recorded into an I / O operation set to keep track of all the I / O operations being executed.
[0173] After recording the I / O operations, check whether the number of I / O operations currently in execution is lower than the preset I / O operation upper limit threshold, that is, obtain the number of elements in the I / O operation set. If the number of elements is lower than the I / O operation upper limit threshold, you can continue to initiate new I / O operations; if it reaches the threshold, suspend initiating new I / O operations until an I / O operation is completed.
[0174] b3, in response to detecting that any I / O operation is completed, removing the completed I / O operation from the I / O operation set, and triggering the number of I / O operations currently in execution to be lower than a preset I / O operation number upper limit threshold.
[0175] When any I / O operation is completed, in order to ensure that the I / O operation set only contains the currently executing I / O operation, such as Figure 3 As shown, the completed I / O operation is removed from the I / O operation set. After the completed I / O operation is removed, the number of elements in the I / O operation set will be lower than the upper limit of the number of I / O operations. The number of I / O operations in the executing state is automatically satisfied to be lower than the preset upper limit of the number of I / O operations. New I / O operations can continue to be initiated for unexplored vector nodes in the candidate vector pool.
[0176] In the disclosed embodiment, an I / O operation set is constructed to maintain and manage I / O operations in execution during the retrieval process, and a new I / O operation is triggered when the I / O pipeline is idle, thereby fully utilizing the I / O pipeline, improving the reading efficiency of neighboring vector nodes of unexplored vector nodes in the candidate vector pool, and improving the overall retrieval efficiency.
[0177] In some embodiments, tightly coupling I / O operation reading with subsequent distance calculation logic can lead to idle CPU resources due to I / O waiting, and may also cause processing confusion due to the disorder of I / O operation return results. Based on this, regarding the aforementioned step S102, when any I / O operation is completed, determining the distance between each neighbor vector node returned by the I / O operation and the target vector, this embodiment proposes an asynchronous decoupled I / O processing and calculation separation mechanism. By decoupling I / O operations from distance calculation, processing confusion caused by I / O blocking or disordered returns can be avoided. This can be achieved through the following steps c1-c2:
[0178] c1, in response to the completion of any I / O operation, caching the node to be accessed targeted by the completed I / O operation and each neighbor vector node of the node to be accessed read into a set of nodes to be processed;
[0179] c2, according to the cache order of each to-be-visited node in the to-be-processed node set, determine the distance between each neighbor vector node of each to-be-visited node and the target vector.
[0180] See also Figure 4 An exemplary process diagram of caching the results returned by an I / O operation into a collection for sequential consumption is shown. A pending node set is constructed to store the neighbor vector node vectors returned when each I / O operation is completed. One element represents a node to be accessed and its neighbor vector node. The elements in the pending node set are written when the I / O is completed. The thread that calculates the node distance continues to consume the elements in the pending node set sequentially in the cache order.
[0181] During the process of sequentially consuming the elements in the set of nodes to be processed in a cached order, each time a distance calculation is performed on each neighbor vector node of a node to be visited from the set of nodes to be processed, the node to be visited and its neighbor vector nodes may be removed from the set of nodes to be processed while the distances are being calculated. Alternatively, upon completion of the distance calculation and candidate vector pool update process for the neighbor vector nodes of the node to be visited, that is, in response to completion of the candidate vector pool update based on the distances between the neighbor vector nodes of the node to be visited and the target vector, the node to be visited and its neighbor vector nodes may be deleted from the set of nodes to be processed.
[0182] by Figure 1C Taking the I / O operations OP1-OP3 shown as an example, the set of nodes to be processed U is initialized to empty. Assuming that OP1 is completed during the process of initiating I / O operation OP3, the node J: (I, B, K) related to OP1 is cached to U = {J: (I, B, K)}; if it is detected that the set of nodes to be processed is not empty, the elements J: (I, B, K) in the set of nodes to be processed are read sequentially, and the distances between the neighbor vector nodes I, B, K and the target vector V are calculated and the candidate vector pool is updated. During this calculation process, if OP2 and OP3 are completed, the return results of OP2 and OP3 are cached in the set U in turn.
[0183] That is, the process of caching the node to be visited and its neighbor vector nodes into the set of nodes to be processed is independent of the process of obtaining multiple neighbor vector nodes of each node to be visited from the set of nodes to be processed for distance calculation. The two are carried out in parallel, realizing the decoupling of the I / O read operation and the distance calculation steps, reducing the sequential dependence between the retrieval steps, and thus improving the retrieval efficiency.
[0184] In some embodiments, the candidate vector pool may not contain any unexplored vector nodes because the candidate vector pool has not been updated yet or has reached the search end condition. This may affect the initiation of new I / O operations when the I / O pipeline is idle. Therefore, this embodiment analyzes the different node conditions in the candidate vector pool in combination with the I / O operation set and the set of nodes to be processed in the above embodiment. When the number of I / O operations currently in execution is lower than the preset upper limit threshold of the number of I / O operations as described in step S101, the unexplored vector node closest to the target vector is selected from the candidate vector pool as the node to be visited. Figure 5 An example interactive flow chart of initiating a new I / O operation when an I / O pipeline is idle is shown, which can be processed in the following manner:
[0185] S501, in response to the number of I / O operations currently in execution being lower than the upper limit threshold of the number of I / O operations, determining whether there is an unexplored vector node in the candidate vector pool;
[0186] The candidate vector nodes in the candidate vector pool are divided into explored vector nodes and unexplored vector nodes. An explored vector node indicates that an I / O operation has been initiated to obtain the candidate vector nodes of its neighboring vector nodes, while an unexplored vector node indicates that an I / O operation needs to be initiated to read the candidate vector nodes of its neighboring vector nodes from the storage medium.
[0187] Continue with Figure 1C For example, after initiating OP1-OP3, if the number of I / O operations in execution reaches the upper limit of the I / O operation quantity, new I / O operations will be stopped. When OP1 is executed and returns the neighboring vector nodes I, B, and K of the candidate vector node J, then:
[0188] The number of I / O operations in the executing state W=2 is lower than the upper limit threshold of the number of I / O operations W0=3, which triggers the number of I / O operations currently in the executing state to be lower than the upper limit threshold of the number of I / O operations. Since the candidate vector pool is not updated according to the result returned by OP1 at this time, the candidate vector pool PL={J:4, M:5.8, T:6, I:6.5} is checked to see whether there is any unexplored vector node.
[0189] If so, select the unexplored vector node closest to the target vector from the candidate vector pool as the node to be visited in step S502;
[0190] If there are unexplored vector nodes in the candidate vector pool, a node closest to the target vector can be directly selected as the node to be visited, and an I / O operation can be initiated for the node to be visited.
[0191] For example, when OP1 is executed, if there is an unexplored vector node I in the candidate vector pool, then the node I is treated as the node to be visited, and an I / O operation is initiated for the node I to read the neighboring vector nodes (Q, A, J) of the node I in the graph structure vector index from the storage medium.
[0192] S503, if not, determining whether the I / O operation set and the to-be-processed node set are both empty;
[0193] The I / O operation set stores I / O operation records in execution state, and the pending node set stores neighbor node vector nodes returned after the I / O operation is completed and whose distances have not been calculated and the candidate vector pool has not been updated. By judging whether these two sets are empty, it can be determined whether all potential neighbor vector nodes in the graph structure vector index have been explored.
[0194] S5041: If yes, that is, when both the I / O operation set and the to-be-processed node set are empty, generating a search result for the target vector based on the vector nodes included in the candidate vector pool;
[0195] If the I / O operation set is empty, it means there are no unfinished I / O operations. If the pending node set is empty, it means there are no pending node distance calculations or candidate vector pool updates. If both are empty, it means the candidate vector pool has reached a stable state and no further iteration is required. At this point, the search process can be terminated and the final search results can be generated based on the explored vector nodes in the current candidate vector pool.
[0196] Since the read node to be accessed and its neighboring vector nodes can be removed from the pending node set while reading from the set, in this manner, when both the I / O operation set and the pending node set are empty, there may be neighboring vector nodes that are in the distance calculation / candidate vector pool update stage and have not yet been completed. Therefore, when both sets are empty, a set waiting time, such as 1 second, can be waited. If the candidate vector pool is not updated after the set waiting time, a search result for the target vector is generated based on the vector nodes included in the candidate vector pool. If the candidate vector pool is updated after the set waiting time, step S501 is repeated to continue determining whether there are unexplored vector nodes in the candidate vector pool.
[0197] S5042: If not, that is, when at least one of the I / O operation set and the to-be-processed node set is not empty, then after the candidate vector pool is updated, continue to determine whether there is an unexplored vector node in the candidate vector pool.
[0198] If the I / O operation set is not empty, it means that there is an I / O operation in the system (that is, an operation that is reading data from the storage medium). The I / O operation has not yet been completed, and its result has not yet been processed or cached in the pending node set;
[0199] If the pending node set is not empty, it means that there is neighbor vector node data returned by the completed I / O operation, but its distance from the target vector has not been further calculated and the candidate vector pool has not been updated. That is, there are still pending calculation tasks to update the candidate vector pool.
[0200] If at least one of the I / O operation set and the pending node set is not empty, it indicates that the search is in progress. At this time, the absence of unexplored vector nodes in the candidate vector pool is because the candidate vector pool has not been updated. Therefore, after the candidate vector pool is updated, it is possible to continue to determine whether there are unexplored vector nodes in the candidate vector pool to continue initiating I / O operations on the unexplored vector nodes.
[0201] In the embodiment of the present disclosure, when the number of I / O operations is lower than the upper threshold of the number of operations, it is determined whether there are unexplored vector nodes in the candidate vector pool. If there are no unexplored vector nodes in the candidate vector pool, the vector status in the candidate vector pool is further determined by combining the I / O operation set and the set of nodes to be processed. This avoids blindly initiating unnecessary I / O operations when the I / O pipeline is idle, thereby enabling more efficient resource utilization and reducing resource waste.
[0202] In some embodiments, the updating of the candidate vector pool based on the distance between each neighbor vector node and the target vector as described in step S102 can also be performed by directly removing duplicate nodes from each neighbor vector node and the candidate vector nodes already in the candidate vector pool and then re-arranging them in ascending order of distance. Based on the sorting results, at most L nodes are determined as the storage content of the updated candidate vector pool. This method can be implemented by the following steps d1-d3:
[0203] d1, merging the neighboring vector nodes with the existing vector nodes stored in the candidate vector pool to remove duplicates, to obtain a deduplicated node set, and sorting the vector nodes in the deduplicated node set in ascending order according to the distance between the vector node and the target vector;
[0204] Each neighbor vector node currently calculated is merged with the existing vector nodes stored in the candidate vector pool, and duplicate nodes are removed to obtain a deduplicated node set, so as to ensure that the nodes in the candidate vector pool are unique and avoid repeated processing and storage.
[0205] For example, Figure 1CTaking the candidate vector pool update after initiating I / O operations OP1-OP3 and completing OP1 as an example, the neighbor nodes I, B, and K are merged with the existing vector nodes J, M, T, and I in the candidate vector pool to remove duplicates, and a deduplicated node set {B, K, J, M, T, I} is obtained. The nodes in this set are sorted in ascending order according to their distance to the target vector V to quickly identify the node closest to the target vector.
[0206] d2: If the number of nodes in the deduplicated node set is greater than L, the top L vector nodes and their distances to the target vector are used as the storage content of the updated candidate vector pool;
[0207] d3: When the number of nodes in the deduplicated node set is less than or equal to L, all sorted vector nodes and their distances to the target vector are used as storage contents of the updated candidate vector pool.
[0208] Since the candidate vector pool has a maximum length limit and can store at most L candidate node vectors, the candidate vector pool can be quickly updated by determining the relationship between the number of nodes in the deduplicated node set and L. If the number of nodes in the deduplicated node set is less than or equal to L, then all nodes in the deduplicated node set can be included in the candidate vector pool as candidate vector nodes. Otherwise, only the first L nodes closest to the target vector can be included in the candidate vector pool.
[0209] Still taking the above-mentioned deduplicated node set {B, K, J, M, T, I} as an example, since the number of nodes in the deduplicated node set is equal to the maximum length of PL 6, all nodes in the deduplicated node set are directly used as nodes to be stored in the candidate vector pool.
[0210] In the embodiment of the present disclosure, by combining deduplication processing and distance sorting, repeated processing and storage of the same nodes can be avoided, the candidate vector pool can be dynamically maintained, and it can be ensured that it always contains the L candidate nodes closest to the target vector, thereby improving the efficiency of subsequent retrieval or calculation processes.
[0211] Corresponding to the embodiment of the above-mentioned vector retrieval method, see Figure 6 As shown, the present application also provides an embodiment of a vector retrieval device, the device comprising:
[0212] The I / O operation management module 601 is configured to, during a process of retrieving a target vector based on a graph structure vector index in a storage medium, select an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited if the number of I / O operations currently in execution is lower than a preset upper threshold for the number of I / O operations, initiate an I / O operation on the node to be visited, and change the state of the node to be visited to an explored vector node; wherein the I / O operation is configured to read neighboring vector nodes of the node to be visited from the graph structure vector index stored in the storage medium;
[0213] The candidate vector pool updating module 602 is configured to, upon completion of any I / O operation, determine the distances between each neighbor vector node returned by the I / O operation and the target vector, and update the candidate vector pool based on the distances between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
[0214] In the process of retrieving a target vector based on a graph structure vector index in a storage medium, if the number of input / output (I / O) operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited, initiating an I / O operation on the node to be visited, and changing the state of the node to be visited to an explored vector node; wherein the I / O operation is used to read each neighbor vector node of the node to be visited from the graph structure vector index stored in the storage medium;
[0215] When any I / O operation is completed, the distance between each neighbor vector node returned by the I / O operation and the target vector is determined, and the candidate vector pool is updated based on the distance between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
[0216] In some embodiments, the apparatus further comprises:
[0217] a node ratio calculation module, configured to determine, in response to the completion of any I / O operation, the ratio of nodes in the candidate vector pool of the to-be-accessed nodes targeted by the historical I / O operation that existed at the time the I / O operation was completed; wherein the historical I / O operation includes all completed I / O operations from the start of the search to the completion of the I / O operation;
[0218] The threshold adjustment module is used to adjust the upper limit threshold of the I / O operation quantity based on the node ratio being greater than a set threshold.
[0219] In some embodiments, the node ratio calculation module is specifically used to:
[0220] In response to the completion of any I / O operation, adding the to-be-visited node targeted by the completed I / O operation to a first node list, and storing all vector nodes in the candidate vector pool at the time of completion of the I / O operation into a second node list; wherein the first node list is used to store the to-be-visited nodes targeted by the historical I / O operation;
[0221] Determine common elements between the first node list and the second node list, and count the sum of the number of occurrences of each of the common elements in the first node list to obtain an existence count;
[0222] The node ratio is obtained based on the number of existences and the number of nodes in the first node list.
[0223] In some embodiments, the apparatus further comprises:
[0224] Constructing an I / O operation set, wherein the I / O operation set is used to record I / O operations in an execution state;
[0225] After initiating the I / O operation for the node to be accessed, recording the initiated I / O operation in the I / O operation set, and detecting whether the number of I / O operations currently in execution is lower than a preset I / O operation number upper threshold;
[0226] In response to detecting that any I / O operation is completed, the completed I / O operation is removed from the I / O operation set, and the number of I / O operations currently in execution is triggered to be lower than a preset I / O operation number upper threshold.
[0227] In some embodiments, the candidate vector pool updating module is specifically configured to:
[0228] In response to completion of any I / O operation, the node to be accessed targeted by the completed I / O operation and each neighbor vector node of the node to be accessed that has been read are cached in a set of nodes to be processed;
[0229] According to the cache order of each to-be-visited node in the to-be-processed node set, the distance between each neighbor vector node of each to-be-visited node and the target vector is determined.
[0230] In some embodiments, the I / O operation management module is specifically configured to:
[0231] In response to the number of I / O operations currently being executed being lower than the upper limit threshold of the number of I / O operations, determining whether there is an unexplored vector node in the candidate vector pool;
[0232] If it exists, the unexplored vector node closest to the target vector is selected from the candidate vector pool as the node to be visited;
[0233] If not: when both the I / O operation set and the set of nodes to be processed are empty, generating a search result for the target vector based on the vector nodes included in the candidate vector pool; when at least one of the I / O operation set and the set of nodes to be processed is not empty, continuing to determine whether there is an unexplored vector node in the candidate vector pool after the candidate vector pool is updated.
[0234] In some embodiments, the candidate vector pool updating module is specifically configured to:
[0235] Based on the existing candidate vector nodes in the candidate vector pool, deduplicating the neighbor vector nodes to obtain deduplicated neighbor vector nodes;
[0236] When the number N of the existing candidate vector nodes is less than L, the (LN) neighbor vector nodes closest to the target vector are selected from the deduplicated neighbor vector nodes, and are merged into the candidate vector pool in ascending order of distance;
[0237] When the number of the existing candidate vector nodes is L, the first node closest to the target vector among the neighboring vector nodes after deduplication is determined, and a check is performed to determine whether the distance corresponding to the first node is greater than the farthest candidate vector node in the candidate vector pool. If so, updating the candidate vector pool is stopped. If not, the farthest candidate vector node is replaced with the first node, and a new first node is re-determined from the neighboring vector nodes other than the first node.
[0238] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0239] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application. A person of ordinary skill in the art can understand and implement the present invention without inventive effort.
[0240] The embodiment of the present application also provides an electronic device, the structural diagram of the electronic device is as follows Figure 7As shown, the electronic device 700 includes at least one processor 701, a memory 702, and a bus 703. The at least one processor 701 is electrically connected to the memory 702. The memory 702 is configured to store at least one computer-executable instruction, and the processor 701 is configured to execute the at least one computer-executable instruction, thereby performing the steps of any vector retrieval method provided in any embodiment or any optional implementation manner of the present application.
[0241] Furthermore, the processor 701 may be a Field-Programmable Gate Array (FPGA) or other devices with logic processing capabilities, such as a Microcontroller Unit (MCU) or a Central Processing Unit (CPU).
[0242] An embodiment of the present application further provides another readable storage medium storing a computer program, which is used to implement the steps of any vector retrieval method provided in any embodiment or any optional implementation manner of the present application when executed by a processor.
[0243] The readable storage media provided in the embodiments of the present application include, but are not limited to, any type of disk (including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic cards, or optical cards. In other words, the readable storage medium includes any medium that can store or transmit information in a readable form by a device (e.g., a computer).
[0244] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the particular order shown or sequential sequence to achieve the desired results. In some implementations, multitasking and parallel processing may be advantageous.
[0245] Although this specification includes many specific implementation details, these should not be interpreted as limiting the scope of any invention or the scope of protection claimed, but are mainly used to describe the features of specific embodiments of specific inventions. Certain features described in multiple embodiments within this specification may also be implemented in combination in a single embodiment. On the other hand, the various features described in a single embodiment may also be implemented separately in multiple embodiments or in any suitable sub-combination. In addition, although features may work in certain combinations as described above and even initially claimed as such, one or more features from the claimed combination may be removed from the combination in some cases, and the claimed combination may point to a sub-combination or a variation of the sub-combination.
[0246] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A vector retrieval method, characterized in that: The method comprises: In the process of retrieving a target vector based on a graph structure vector index in a storage medium, if the number of input / output (I / O) operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited, initiating an I / O operation on the node to be visited, and changing the state of the node to be visited to an explored vector node; wherein the I / O operation is used to read each neighbor vector node of the node to be visited from the graph structure vector index stored in the storage medium; When any I / O operation is completed, the distance between each neighbor vector node returned by the I / O operation and the target vector is determined, and the candidate vector pool is updated based on the distance between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
2. The method according to claim 1, characterized in that The method further comprises: In response to completion of any I / O operation, determining a proportion of nodes in the candidate vector pool that existed at the time of completion of the I / O operation among the to-be-accessed nodes targeted by the historical I / O operation; wherein the historical I / O operation includes all completed I / O operations from the start of the search to the completion of the I / O operation; Based on the node ratio being greater than a set threshold, the upper limit threshold of the I / O operation quantity is adjusted.
3. The method according to claim 2, characterized in that Determining the proportion of nodes in the candidate vector pool that exist in the to-be-accessed nodes targeted by the historical I / O operation when the I / O operation is completed includes: In response to the completion of any I / O operation, the to-be-accessed node targeted by the completed I / O operation is added to a first node list, and all vector nodes in the candidate vector pool at the time of the completion of the I / O operation are stored in a second node list; wherein the first node list is used to store the to-be-accessed nodes targeted by the historical I / O operation; determining common elements between the first node list and the second node list, and counting the sum of the number of occurrences of each of the common elements in the first node list to obtain an existence count; and obtaining the node ratio based on the existence count and the number of nodes in the first node list; or, In response to completion of any I / O operation, detecting whether the to-be-accessed node targeted by the completed I / O operation exists in the candidate vector pool at the time of completion of the I / O operation: if so, increasing the number of nodes in the candidate vector pool by one and increasing the total number of nodes by one; if not, increasing the total number of nodes by one; and obtaining the node ratio based on the updated number of nodes in the candidate vector pool and the total number of nodes.
4. The method according to claim 1, wherein The method further comprises: Constructing an I / O operation set, wherein the I / O operation set is used to record I / O operations in an execution state; After initiating the I / O operation for the node to be accessed, recording the initiated I / O operation in the I / O operation set, and detecting whether the number of I / O operations currently in execution is lower than a preset I / O operation number upper threshold; In response to detecting that any I / O operation is completed, the completed I / O operation is removed from the I / O operation set, and the number of I / O operations currently in execution is triggered to be lower than a preset I / O operation number upper threshold.
5. The method according to claim 1 or 4, characterized in that When any I / O operation is completed, determining the distance between each neighbor vector node returned by the I / O operation and the target vector includes: In response to completion of any I / O operation, the node to be accessed targeted by the completed I / O operation and each neighbor vector node of the node to be accessed that has been read are cached in a set of nodes to be processed; According to the cache order of each to-be-visited node in the to-be-processed node set, the distance between each neighbor vector node of each to-be-visited node and the target vector is determined.
6. The method according to claim 5, characterized in that When the number of I / O operations currently being executed is lower than a preset upper threshold of the number of I / O operations, selecting an unexplored vector node closest to the target vector from the candidate vector pool as a node to be visited includes: In response to the number of I / O operations currently being executed being lower than the upper limit threshold of the number of I / O operations, determining whether there is an unexplored vector node in the candidate vector pool; If it exists, the unexplored vector node closest to the target vector is selected from the candidate vector pool as the node to be visited; If not: when both the I / O operation set and the set of nodes to be processed are empty, generating a search result for the target vector based on the vector nodes included in the candidate vector pool; when at least one of the I / O operation set and the set of nodes to be processed is not empty, continuing to determine whether there is an unexplored vector node in the candidate vector pool after the candidate vector pool is updated.
7. The method according to claim 1, characterized in that The updating of the candidate vector pool based on the distance between each neighbor vector node and the target vector includes: Based on the existing candidate vector nodes in the candidate vector pool, deduplicating the neighbor vector nodes to obtain deduplicated neighbor vector nodes; When the number N of the existing candidate vector nodes is less than L, the (LN) neighbor vector nodes closest to the target vector are selected from the deduplicated neighbor vector nodes, and are merged into the candidate vector pool in ascending order of distance; When the number of the existing candidate vector nodes is L, the first node closest to the target vector among the neighboring vector nodes after deduplication is determined, and a check is performed to determine whether the distance corresponding to the first node is greater than the farthest candidate vector node in the candidate vector pool. If so, updating the candidate vector pool is stopped. If not, the farthest candidate vector node is replaced with the first node, and a new first node is re-determined from the neighboring vector nodes other than the first node.
8. A vector search device, characterized in that: The device comprises: An I / O operation management module is configured to, during a process of retrieving a target vector based on a graph structure vector index in a storage medium, select, when the number of I / O operations currently in execution is lower than a preset upper threshold for the number of I / O operations, an unexplored vector node closest to the target vector from a candidate vector pool as a node to be visited, initiate an I / O operation on the node to be visited, and change the state of the node to be visited to an explored vector node; wherein the I / O operation is configured to read neighboring vector nodes of the node to be visited from the graph structure vector index stored in the storage medium; The candidate vector pool updating module is configured to, upon completion of any I / O operation, determine the distance between each neighbor vector node returned by the I / O operation and the target vector, and update the candidate vector pool based on the distance between each neighbor vector node and the target vector, so that the updated candidate vector pool stores at most L vector nodes closest to the target vector.
9. An electronic device, characterized in that: include: Memory, processor; The memory is used to store computer programs; The processor is configured to call the computer program to implement the method according to any one of claims 1 to 7.
10. A readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.