Approximate nearest neighbor search method and approximate nearest neighbor search system
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- KIOXIA CORP
- Filing Date
- 2024-12-04
- Publication Date
- 2026-06-16
Smart Images

Figure 2026097513000001_ABST
Abstract
Claims
1. An approximate nearest neighbor search method for a vector database configured to store multiple vectors, each containing multiple feature values corresponding to multiple dimensions, This involves managing cluster-type index information to define multiple clusters, each having a reference point, and each cluster belonging to a group of vectors adjacent to that reference point. Managing graph-type index information for defining an inter-cluster graph that includes multiple nodes corresponding to each of the multiple clusters, and multiple edges for connecting nodes corresponding to clusters having a reference position close to each other. The process involves receiving a query vector containing feature values for each of the aforementioned multiple dimensions, A first process is performed to determine the cluster having the reference position closest to the query vector among the aforementioned multiple clusters as the starting cluster for the search. The search involves finding the nearest neighbor vector within the search-start cluster from among the vectors belonging to the search-start cluster that is closest to the query vector, and using that vector as the nearest neighbor vector within the search-start cluster. The process involves traversing the inter-cluster graph to select one or more target clusters adjacent to the search start cluster, and then searching for the nearest neighbor vector within each of the one or more target clusters, where the vector closest to the query vector is selected from the vectors belonging to each of the target clusters. The system includes outputting the vector that is closest to the query vector from among the nearest neighbor vectors found from the search start cluster and the nearest neighbor vectors found from each of the one or more target clusters, as the approximate nearest neighbor vector of the query vector. Approximate nearest neighbor search method.
2. The cluster-type index information includes, for each of the plurality of clusters, a list of belonging vectors indicating the identifier of each vector belonging to the cluster, The graph-type index information includes, for each of the plurality of clusters, an adjacency list indicating the identifier of each adjacent cluster connected to the cluster by an edge, When adding a new vector to the aforementioned vector database, Identifying a first cluster among the aforementioned multiple clusters that has a reference position closest to the new vector, The system further comprises registering the new vector in the first belonging vector list of the first cluster without rewriting the adjacency list corresponding to each of the adjacent clusters of the first cluster. The approximate nearest neighbor search method according to claim 1.
3. When adding the new vector to the aforementioned vector database, The detection of whether the sum of the number of vectors already belonging to the first cluster plus 1 exceeds the upper limit, Upon detecting that the sum exceeds the upper limit, a new cluster is created having a reference position close to the reference position of the first cluster, The system further comprises performing a second process to add the new cluster as a second cluster to the inter-cluster graph, The second process described above is: The process involves registering the identifier of the first cluster and the identifier of the third cluster, which is an adjacent cluster of the first cluster, in the second adjacency list corresponding to the second cluster. A process to register the identifier of the second cluster in the first adjacency list corresponding to the first cluster, A process to identify one or more vectors from among all the vectors already belonging to the first cluster and the new vectors, whose distance to the reference position of the second cluster is shorter than the distance to the reference position of the first cluster, The process of registering the identifier of each of the one or more vectors identified above in the second belonging vector list corresponding to the second cluster, The process includes deleting the identifier of each vector registered in the first belonging vector list corresponding to the first cluster from the first belonging vector list, among the one or more vectors identified above. The approximate nearest neighbor search method according to claim 2.
4. During the execution of the second process, it is detected that the second cluster has been determined to be the search start cluster, In response to detecting that the second cluster was determined to be the search start cluster during the execution of the second process, Adding all vectors registered in the first belonging vector list of the first cluster to the search target, The method further comprises searching for the vector closest to the query vector from among all the vectors registered in the second belonging vector list of the second cluster and all the vectors registered in the first belonging vector list of the first cluster, and using that vector as the nearest neighbor vector within the search starting cluster. The approximate nearest neighbor search method according to claim 3.
5. When deleting a vector from the aforementioned vector database, Identifying the fourth cluster to which the aforementioned vector belongs, Deleting the one vector from the fourth belonging vector list of the fourth cluster, In response to detecting that the number of vectors belonging to the fourth cluster has become zero due to the deletion of the aforementioned vector, Identifying one or more fifth clusters registered as adjacent clusters of the fourth cluster in the fourth adjacency list of the fourth cluster, The system further comprises: for each of the one or more fifth clusters, the process of removing the identifier of the fourth cluster from the fifth adjacency list of the fifth cluster; the process of determining which clusters are not registered in the fifth adjacency list of the fifth cluster but are registered in the fourth adjacency list of the fourth cluster; and the process of registering the identifier of the determined cluster in the fifth adjacency list of the fifth cluster. The approximate nearest neighbor search method according to claim 3.
6. The aforementioned clusters are managed using a hierarchical cluster structure that includes the lowest layer and multiple upper layers. The lowest layer mentioned above is, Multiple lowest-level clusters, each having a reference position, and each of these clusters includes multiple lowest-level clusters to which a group of vectors adjacent to that reference position belongs. Each of the aforementioned clusters corresponds to the respective lowest-level clusters, The highest layer among the aforementioned multiple upper layers is, An upper-level cluster having a reference point, which includes as the top-level cluster a plurality of lower-level clusters each having a reference point adjacent to that reference point, Each of the above-mentioned upper layers, excluding the top-level layer, Multiple upper-level clusters, each having a reference point, and each of these upper-level clusters includes multiple lower-level clusters, each having a reference point adjacent to its own reference point. The aforementioned cluster-type index information is, For each of the upper-layer clusters within the aforementioned multiple upper layers, the following are included: (1) a list of lower-layer clusters indicating the identifier of each lower-layer cluster belonging to the upper-layer cluster; (2) first relative position information between the reference position of the upper-layer cluster and the reference position of each lower-layer cluster belonging to the upper-layer cluster; and (3) second relative position information between the reference position of the upper-layer cluster and the reference position of each of the clusters of the same layer, wherein each of the clusters of the same layer is another upper-layer cluster other than the upper-layer cluster, which is included in the same layer as the layer containing the upper-layer cluster. Executing the first process described above means The process involves setting the top-level cluster as the target cluster, and using the first relative position information of the target cluster and the second relative position information corresponding to each of the lower-level clusters belonging to the target cluster, searching for the lower-level cluster having the reference position closest to the query vector from among the lower-level clusters belonging to the target cluster. The search process includes: setting the searched lower-layer cluster as a new target cluster; and using the first relative position information corresponding to the new target cluster and the second relative position information corresponding to each of the lower-layer clusters belonging to the new target cluster, searching for a lower-layer cluster having the reference position closest to the query vector from among the lower-layer clusters belonging to the new target cluster. The search process is repeated until one of the plurality of lowest-level clusters is found to be the lower-level cluster having the reference position closest to the query vector, The approximate nearest neighbor search method according to claim 1.
7. The first relative position information includes distance information indicating the distance between the reference position of the upper-layer cluster and the reference position of the lower-layer cluster for each of the lower-layer clusters belonging to the upper-layer cluster, The second relative position information includes distance information indicating the distance between the reference position of the upper-level cluster and the reference position of the same-level cluster for each of the same-level clusters. The approximate nearest neighbor search method according to claim 6.
8. The first relative position information further includes, for each lower-layer cluster belonging to the upper-layer cluster, azimuth information indicating the direction from the reference position of the upper-layer cluster to the reference position of the lower-layer cluster, The second relative position information further includes, for each of the same-layer clusters, azimuth information indicating the direction from the reference position of the upper-layer cluster to the reference position of the same-layer cluster. The approximate nearest neighbor search method according to claim 7.
9. The aforementioned graph-type index information is, For each of the aforementioned clusters, an adjacency list is provided that indicates the identifier of each adjacent cluster connected to the cluster by an edge, For each of the adjacent clusters of the plurality of clusters, the first orientation information includes an orientation indicating the orientation from the reference position of the cluster to the reference position of the adjacent cluster, When performing the search on one or more target clusters adjacent to the search initiation cluster, Calculating the first orientation from the reference position of the search start cluster to the query vector, The invention further comprises selecting, using orientation information corresponding to each of the adjacent clusters of the search initiation cluster, the adjacent cluster having an orientation most similar to the first orientation, with priority over other adjacent classes of the search initiation cluster, as one of the one or more target clusters to be searched. The approximate nearest neighbor search method according to claim 1.
10. The graph-type index information includes, for each of the plurality of clusters, an adjacency list indicating the identifier of each adjacent cluster connected to the cluster by an edge, The plurality of vectors, the cluster-type index information, and the graph-type index information are stored in a secondary storage device. The adjacency list is stored in a second storage area within the secondary storage device, which is different from the first storage area within the secondary storage device where the plurality of vectors are stored. The approximate nearest neighbor search method according to claim 1.
11. Main memory and A secondary storage device configured to store a vector database in which multiple vectors are stored, each containing multiple feature values corresponding to multiple dimensions, and The system comprises a processor capable of accessing the main memory and the secondary storage device, The aforementioned processor, A cluster-type index information is managed to define multiple clusters, each having a reference position, and each cluster having a group of vectors adjacent to that reference position. The system manages graph-type index information for defining an inter-cluster graph that includes multiple nodes corresponding to each of the aforementioned multiple clusters, and multiple edges for connecting nodes corresponding to clusters that have a reference position close to each other. A query vector containing feature values is received for each of the aforementioned multiple dimensions. A first process is executed to determine the cluster having the reference position closest to the query vector among the aforementioned multiple clusters as the search starting cluster. From the vectors belonging to the search start cluster, the vector closest to the query vector is searched for and designated as the nearest neighbor vector within the search start cluster. While traversing the inter-cluster graph, select one or more target clusters adjacent to the search start cluster, and from the vectors belonging to each of the one or more target clusters, search for the vector closest to the query vector as the nearest neighbor vector within each target cluster. The system is configured to output the vector that is closest to the query vector among the nearest neighbor vectors found from the search start cluster and the nearest neighbor vectors found from each of the one or more target clusters, as the approximate nearest neighbor vector of the query vector. Approximate nearest neighbor search system.
12. The cluster-type index information includes, for each of the plurality of clusters, a list of belonging vectors indicating the identifier of each vector belonging to the cluster, The graph-type index information includes, for each of the plurality of clusters, an adjacency list indicating the identifier of each adjacent cluster connected to the cluster by an edge, The aforementioned processor, When adding a new vector to the aforementioned vector database, Among the multiple clusters, a first cluster having a reference position closest to the new vector is identified. The system is further configured to register the new vector in the first belonging vector list of the first cluster without rewriting the adjacency list corresponding to each of the adjacent clusters of the first cluster. The approximate nearest neighbor search system according to claim 11.
13. The aforementioned processor, When adding the new vector to the aforementioned vector database, In response to detecting that the sum of the number of vectors already belonging to the first cluster plus 1 exceeds the upper limit, a new cluster is created having a reference position close to the reference position of the first cluster. The system is further configured to perform a second process in which the new cluster is added as a second cluster to the inter-cluster graph, The second process described above is: The process involves registering the identifier of the first cluster and the identifier of the third cluster, which is an adjacent cluster of the first cluster, in the second adjacency list corresponding to the second cluster. A process to register the identifier of the second cluster in the first adjacency list corresponding to the first cluster, A process to identify one or more vectors from among all the vectors already belonging to the first cluster and the new vectors, whose distance to the reference position of the second cluster is shorter than the distance to the reference position of the first cluster, The process of registering the identifier of each of the one or more vectors identified above in the second belonging vector list corresponding to the second cluster, The process includes deleting the identifier of each vector registered in the first belonging vector list corresponding to the first cluster from the first belonging vector list, among the one or more vectors identified above. The approximate nearest neighbor search system according to claim 12.
14. The aforementioned processor, In response to detecting that the second cluster was determined to be the search start cluster during the execution of the second process, Add all vectors registered in the first belonging vector list of the first cluster to the search target, The system is further configured to search for the vector closest to the query vector from among all the vectors registered in the second belonging vector list of the second cluster and all the vectors registered in the first belonging vector list of the first cluster, and to use that as the nearest neighbor vector within the search starting cluster. The approximate nearest neighbor search system according to claim 13.
15. The aforementioned processor, When deleting a vector from the aforementioned vector database, Identify the fourth cluster to which the aforementioned vector belongs, Remove the vector from the fourth belonging vector list of the fourth cluster, In response to detecting that the number of vectors belonging to the fourth cluster has become zero due to the deletion of the aforementioned vector, Identify one or more fifth clusters registered as adjacent clusters of the fourth cluster in the fourth adjacency list of the fourth cluster, The system is further configured to perform the following for each of the one or more fifth clusters: deleting the identifier of the fourth cluster from the fifth adjacency list of the fifth cluster; determining which clusters are not registered in the fifth adjacency list of the fifth cluster but are registered in the fourth adjacency list of the fourth cluster; and registering the identifier of the determined cluster in the fifth adjacency list of the fifth cluster. The approximate nearest neighbor search system according to claim 13.