Approximate nearest neighbor search method and approximate nearest neighbor search system

JP2026097516APending Publication Date: 2026-06-16KIOXIA CORP

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 2026097516000001_ABST
    Figure 2026097516000001_ABST
Patent Text Reader

Abstract

This invention provides an approximate nearest neighbor search method that can streamline approximate nearest neighbor search for vector databases. [Solution] According to the embodiment, an approximate nearest neighbor search method for a vector database storing N D-dimensional vectors comprises: managing N first direction information, each representing the direction from a first D-dimensional reference vector to each of the N D-dimensional vectors, with N first direction information being acquired in advance; receiving a D-dimensional query vector; calculating second direction information representing the direction from the first reference vector to the query vector; and using the N first direction information and the second direction information, searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors. N is an integer of 2 or more. D is an integer of 2 or more.
Need to check novelty before this filing date? Find Prior Art

Claims

1. An approximate nearest neighbor search method for a vector database containing N D-dimensional vectors, Each of these is N first direction information representing the direction from a first D-dimensional reference vector to each of the N D-dimensional vectors, and the management of N first direction information acquired in advance, Receiving a D-dimensional query vector, Calculating second direction information representing the direction from the first reference vector to the query vector, The method comprises searching for the nearest neighbor vector of the query vector from the N D-dimensional vectors using the N first directional information and the second directional information, The aforementioned N is an integer greater than or equal to 2, The aforementioned D is an integer greater than or equal to 2. Approximate nearest neighbor search method.

2. Each of the N first distance pieces represents a first distance between the first reference vector and each of the N D-dimensional vectors, and the N first distance pieces acquired in advance are managed. To calculate second distance information indicating the second distance between the first reference vector and the query vector, The method further comprises searching for the nearest neighbor vector of the query vector from the N D-dimensional vectors using the N first orientation information, the N first distance information, the second orientation information, and the second distance information. The approximate nearest neighbor search method according to claim 1.

3. Searching for the nearest approximate neighbor vector of the query vector from the N D-dimensional vectors is: This includes searching from the N D-dimensional vectors for a first D-dimensional vector corresponding to the first orientation information and the first distance information whose similarity to the second orientation information and the second distance information is equal to or greater than a first threshold, The approximate nearest neighbor search method according to claim 2.

4. Searching for the nearest approximate neighbor vector of the query vector from the N D-dimensional vectors is: The method includes searching from the N D-dimensional vectors for a first D-dimensional vector that corresponds to the first directional information and the first distance information, whose similarity to the second directional information and the second distance information is equal to or greater than the first threshold, and whose distance to the query vector is less than the second distance. The approximate nearest neighbor search method according to claim 3.

5. Searching for the first D-dimensional vector from the N D-dimensional vectors is By excluding M D-dimensional vectors from the aforementioned N D-dimensional vectors that correspond to the first distance information indicating the first distance which is more than twice the second distance, (N-M) D-dimensional vectors are obtained. This includes searching for the first D-dimensional vector from the (N-M) D-dimensional vectors, The aforementioned M is an integer greater than or equal to 1. The approximate nearest neighbor search method according to claim 4.

6. Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors further involves, Calculating third distance information that indicates the third distance between the first D-dimensional vector and the query vector, To determine a first range by excluding the range centered on the first reference vector and having a radius of the second distance minus the third distance from the range centered on the first reference vector and having a radius of the second distance plus the third distance, By excluding the first D-dimensional vector and L D-dimensional vectors located outside the first range from the (N-M) D-dimensional vectors, (N-M-L-1) D-dimensional vectors are obtained. The process includes searching for a second D-dimensional vector from the (N-M-L-1) D-dimensional vectors that corresponds to the first orientation information and the first distance information, whose similarity to the second orientation information and the second distance information is equal to or greater than the first threshold, and whose distance from the query vector is less than the third distance. The aforementioned L is an integer greater than or equal to 1. The approximate nearest neighbor search method according to claim 5.

7. Each of the N first distance information items represents the Euclidean distance between the first reference vector and each of the N D-dimensional vectors. The second distance information indicates the Euclidean distance between the first reference vector and the query vector. The approximate nearest neighbor search method according to any one of claims 2 to 6.

8. Searching for the nearest approximate neighbor vector of the query vector from the N D-dimensional vectors includes searching for a first D-dimensional vector from the N D-dimensional vectors that corresponds to the first orientation information and whose similarity to the second orientation information is equal to or greater than a second threshold. The approximate nearest neighbor search method according to claim 1.

9. Managing the N first directional information includes calculating the N first directional information by compressing the directional information indicated by the first difference vector, which is obtained by subtracting the first reference vector from each of the N D-dimensional vectors. Calculating the second direction information includes compressing the direction information indicated by the second difference vector obtained by subtracting the first reference vector from the query vector. The approximate nearest neighbor search method according to claim 8.

10. Managing the N first orientation information means managing the first orientation information corresponding to the first D-dimensional vector among the N first orientation information, Obtaining R first subvectors from the first difference vector obtained by subtracting the first reference vector from the first D-dimensional vector, Converting each of the R first subvectors into R first bit values, This includes calculating the first orientation information corresponding to the first D-dimensional vector, which includes the R first bit values, Calculating the aforementioned second azimuth information is Obtaining R second subvectors from the aforementioned second difference vector, Converting each of the R second subvectors into R second bit values, This includes generating the second orientation information which includes the R second bit values, The aforementioned R is an integer greater than or equal to 2. The approximate nearest neighbor search method according to claim 9.

11. The method further includes obtaining N Hamming distances corresponding to each of the N D-dimensional vectors by calculating the Hamming distance between the second directional information and each of the N first directional information, Searching for the nearest neighbor vector of the query vector includes searching for the first D-dimensional vector from the N D-dimensional vectors that corresponds to a Hamming distance of the N Hamming distances that is less than or equal to the third threshold. The approximate nearest neighbor search method according to claim 10.

12. Searching for the first D-dimensional vector from the N D-dimensional vectors is By excluding P D-dimensional vectors from the N D-dimensional vectors that correspond to Hamming distances exceeding the third threshold among the N Hamming distances, (N-P) D-dimensional vectors are obtained. This includes searching for the first D-dimensional vector from the (N-P) D-dimensional vectors, The aforementioned P is an integer greater than or equal to 1. The approximate nearest neighbor search method according to claim 11.

13. Each of the R subvectors contains D / R elements, Converting each of the R subvectors into R bit values ​​includes converting the corresponding subvector to 1 if the number of first elements that are 0 or greater among the D / R elements is greater than the number of second elements that are less than 0, and converting the corresponding subvector to 0 if the number of first elements is less than or equal to the number of second elements. The approximate nearest neighbor search method according to claim 10.

14. Each of the R subvectors contains D / R elements, Converting each of the R subvectors into R bit values ​​includes converting the corresponding subvector to 1 if one of the elements selected from the D / R elements according to a certain rule is 0 or greater, and converting the corresponding subvector to 0 if the one element is less than 0. The approximate nearest neighbor search method according to claim 10.

15. Each of the R subvectors contains D / R elements, Converting each of the R subvectors into R bit values ​​includes either (1) converting the corresponding subvector to 1 if the first sum of the positive elements among the D / R elements is greater than the second sum of the negative elements, and converting the corresponding subvector to 0 if the first sum is less than or equal to the second sum, or (2) converting the corresponding subvector to 1 if the first sum of the positive elements among the D / R elements is greater than the second sum of the negative elements, and converting the corresponding subvector to 0 if the first sum of the positive elements is less than or equal to the second sum of the negative elements. The approximate nearest neighbor search method according to claim 10.

16. Each of these is N third-direction information, representing the direction from a D-dimensional second reference vector to each of the N D-dimensional vectors, and the management of N previously acquired third-direction information, The method further comprises calculating a fourth directional information representing the direction from the second reference vector to the query vector, Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors includes searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors using the N first directional information, the second directional information, the N third directional information, and the fourth directional information. The approximate nearest neighbor search method according to claim 1.

17. By calculating the Hamming distance between the second directional information and each of the N first directional information, N first Hamming distances corresponding to each of the N D-dimensional vectors are obtained. The method further comprises obtaining N second Hamming distances corresponding to each of the N D-dimensional vectors by calculating the Hamming distance between the fourth directional information and each of the N third directional information, Searching for the nearest neighbor vector of the query vector from the N D-dimensional vectors includes searching for a first D-dimensional vector from the N D-dimensional vectors such that the sum of the corresponding first Hamming distance and second Hamming distance is less than a fourth threshold. The approximate nearest neighbor search method according to claim 16.

18. Managing multiple clusters, each having multiple reference vectors, including a higher-layer cluster and multiple lower-layer clusters, each having a first lower-layer cluster having the first reference vector, Each of these represents a plurality of fifth-direction information pieces that indicate the direction from the upper-layer reference vector of the upper-layer cluster to the respective lower-layer reference vector of the plurality of lower-layer clusters, and manages a plurality of previously acquired fifth-direction information pieces. Calculating sixth directional information representing the direction from the upper layer reference vector to the query vector, The system further comprises using the plurality of fifth orientation information and the sixth orientation information to identify the lower layer reference vector that is closest to the query vector from each of the plurality of lower layer clusters' lower layer reference vectors, and searching for the lower layer cluster having the identified lower layer reference vector as an approximate nearest neighbor cluster. The identified lower layer reference vector is the first reference vector, The approximate nearest neighbor cluster is the first lower layer cluster, The N D-dimensional vectors belong to the first lower layer cluster. The approximate nearest neighbor search method according to claim 1.

19. Each of these is a plurality of fourth distance information pieces indicating the distance between the upper layer reference vector and each of the lower layer reference vectors of the plurality of lower layer clusters, and the plurality of fourth distance information pieces acquired in advance are managed. To calculate a fifth distance information indicating the distance between the aforementioned upper layer reference vector and the aforementioned query vector, The method further comprises using the plurality of fifth orientation information, the plurality of fourth distance information, the sixth orientation information, and the fifth distance information to identify the lower layer reference vector that is closest to the query vector from each of the plurality of lower layer clusters' lower layer reference vectors, and searching for the lower layer cluster having the identified lower layer reference vector as the approximate nearest neighbor cluster. The approximate nearest neighbor search method according to claim 18.

20. Main memory and A secondary storage device configured to store a vector database containing N D-dimensional vectors, The system comprises a processor capable of accessing the main memory and the secondary storage device, The aforementioned processor, Each of these is N first directional information representing the direction from a first D-dimensional reference vector to each of the N D-dimensional vectors, and the N first directional information acquired in advance is managed. A D-dimensional query vector is received to perform an approximate nearest neighbor search on the aforementioned vector database. A second direction information representing the direction from the first reference vector to the query vector is calculated, The system is configured to use the N first directional information and the second directional information to search for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors. The aforementioned N is an integer greater than or equal to 2, The aforementioned D is an integer greater than or equal to 2. Approximate nearest neighbor search system.