Approximate nearest neighbor search method and approximate nearest neighbor search system
By using a hybrid index structure and hierarchical cluster management, the inefficiency of approximate nearest neighbor search in large-scale vector databases is solved, and efficient approximate nearest neighbor vector search is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KIOXIA CORP
- Filing Date
- 2025-09-09
- Publication Date
- 2026-06-05
AI Technical Summary
When performing approximate nearest neighbor search on large-scale vector databases, existing technologies require significant time and electricity costs, making it difficult to perform queries and calculations efficiently.
A hybrid index structure is adopted, combining clustered indexes and graph indexes. Through hierarchical cluster management and inter-cluster graphs, it efficiently searches for approximate nearest neighbor vectors. The index creation and search processes are performed using a clustered index creation unit, a graph index creation unit, and a search unit.
It enables efficient searching of approximate nearest neighbor vectors in large-scale vector databases, reducing computational load and time costs, and improving search efficiency.
Smart Images

Figure CN122153126A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to Approximate Nearest Neighbor Search (ANNS). Background Technology
[0002] In recent years, nearest neighbor search (NNS) has become prevalent for finding nearest neighbor vectors in a vector database through exhaustive search. However, algorithms for approximate nearest neighbor search (APPRS), which quickly search for vectors sufficiently close to the query vector, are being actively developed. However, performing APPRS on a vector database containing a billion-scale dataset (e.g., over a billion vectors) based on a query requires significant time and power costs. Specifically, storing large amounts of multidimensional vectors on main memory or secondary storage, moving data related to multidimensional vectors between main and secondary storage devices or between information processing devices with their own storage, and calculating the similarity between the query vector and multidimensional vectors in the vector database all require considerable time and power. Summary of the Invention
[0003] In one embodiment of the present invention, the objective is to provide an approximate nearest neighbor search method and an approximate nearest neighbor search system that enable more efficient approximate nearest neighbor search for vector databases.
[0004] According to an implementation method, an approximate nearest neighbor search method for a vector database storing N D-dimensional vectors includes: managing N pre-acquired first-positional information, each of the N first-positional information representing the position from a D-dimensional first reference vector to each of the N D-dimensional vectors; receiving a D-dimensional query vector; calculating second-positional information representing the position from the first reference vector to the query vector; and using the N first-positional information and the second-positional information, searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors. N is an integer greater than or equal to 2. D is an integer greater than or equal to 2. Attached Figure Description
[0005] Figure 1 This is a block diagram illustrating an example of the configuration of an approximate nearest neighbor search system involved in the implementation.
[0006] Figure 2 This is a diagram illustrating an example of a hybrid index structure for an approximate nearest neighbor search system involved in an implementation.
[0007] Figure 3 This is a diagram illustrating an example of search processing performed in the approximate nearest neighbor search system involved in the implementation using a hybrid index structure.
[0008] Figure 4A This is a diagram that serves as part of an example illustrating the principle of approximate nearest neighbor vector search using distance and orientation between vectors.
[0009] Figure 4B This is another part of the diagram used to illustrate the principle of approximate nearest neighbor vector search using distance and orientation between vectors.
[0010] Figure 4C This is another part of a diagram used to illustrate the principle of approximate nearest neighbor vector search using distance and orientation between vectors.
[0011] Figure 4D This is another part of a diagram used to illustrate the principle of approximate nearest neighbor vector search using distance and orientation between vectors.
[0012] Figure 5A This is a diagram that serves as part of an example illustrating the principle of approximate nearest neighbor vector search using the distance between vectors.
[0013] Figure 5B This is another part of the diagram used to illustrate the principle of approximate nearest neighbor vector search using the distance between vectors.
[0014] Figure 5C This is another part of a diagram used to illustrate the principle of approximate nearest neighbor vector search using the distance between vectors.
[0015] Figure 6 This is another example of a diagram used to illustrate the principle of approximate nearest neighbor vector search using the distance between vectors.
[0016] Figure 7 This is a diagram illustrating an example of an approximate nearest neighbor cluster search using the distance and orientation between vectors in an approximate nearest neighbor search system according to the implementation method.
[0017] Figure 8 This is a diagram illustrating an example of the probability of occurrence of other vectors in the approximate nearest neighbor search system involved in the implementation, corresponding to the Hamming distance representing the azimuth deviation of the vector from other vectors.
[0018] Figure 9This is a diagram illustrating the first example of an approximate nearest neighbor vector search using the distance and orientation between vectors in the approximate nearest neighbor search system according to the implementation method.
[0019] Figure 10 This is a diagram illustrating a second example of an approximate nearest neighbor vector search using the distance and orientation between vectors in the approximate nearest neighbor search system according to the implementation method.
[0020] Figure 11 This is a diagram illustrating an example of the search range of an approximate nearest neighbor vector in an approximate nearest neighbor search system according to an implementation method, which uses a reference point and multiple auxiliary reference points to narrow down the search range.
[0021] Figure 12 This is a diagram illustrating a structural example of the upper-level (the layer above) index information used in the approximate nearest neighbor search system according to the implementation method.
[0022] Figure 13 This is a diagram illustrating a structural example of the lowest-level (bottom-level) index information used in the approximate nearest neighbor search system involved in the implementation.
[0023] Figure 14 This is a flowchart illustrating an example of a construction process (procedure, steps) performed in an approximate nearest neighbor search system involved in an implementation.
[0024] Figure 15 This is a flowchart illustrating an example of the process of generating first relative position information in an approximate nearest neighbor search system according to the implementation method.
[0025] Figure 16 This is a flowchart illustrating an example of the process of generating second relative position information in an approximate nearest neighbor search system according to the implementation method.
[0026] Figure 17 This is a flowchart illustrating an example of the process of performing an approximate nearest neighbor cluster search in an approximate nearest neighbor search system according to an implementation method.
[0027] Figure 18 This is a flowchart illustrating an example of the nearest neighbor sub-layer cluster search process performed in the approximate nearest neighbor search system involved in the implementation.
[0028] Figure 19 This is a flowchart illustrating an example of the process of performing an approximate nearest neighbor vector search process in an approximate nearest neighbor search system according to the implementation method.
[0029] Explanation of reference numerals in the attached figures
[0030] 1. Approximate nearest neighbor search system; 2. External device; 3. Communication path; 11. Processor; 12. Main memory; 13. Communication interface; 14. Secondary storage device; 111. Cluster-based index creation unit; 112. Graph-based index creation unit; 113. Search unit; 121. Index creation program; 122. Search program; 141. Storage medium (non-volatile memory); 21. Data set; 22. Hybrid index information; 221. Upper-level index information; 222. Lower-level index information; HC hierarchical cluster. Detailed Implementation
[0031] Hereinafter, the embodiments will be described with reference to the accompanying drawings.
[0032] Figure 1 This is a block diagram illustrating a configuration example of the approximate nearest neighbor search system 1 according to the implementation method. The approximate nearest neighbor search system 1 is a computer system configured to perform approximate nearest neighbor search on a vector database.
[0033] The vector database is a database for storing and managing dataset 21. Dataset 21 includes multiple vectors. Each of these vectors is an uncompressed vector, i.e., a full-precision vector.
[0034] The multiple vectors in dataset 21 each contain multiple feature values corresponding to multiple dimensions. When the dimension of each vector is set to D, each vector (D-dimensional vector) is equivalent to a point (data point) in a D-dimensional space. The D elements contained in the D-dimensional vector each represent feature values (real numbers) of D attributes. Each vector is a high-dimensional vector with a dimension D of hundreds or thousands. The dimension D is an integer greater than 2, more specifically, for example, 1024 or 2048. Hereinafter, the D-dimensional space is also referred to as the data space or vector space.
[0035] The approximate nearest neighbor search system 1 receives a query vector based on a query from an external device 2. The query vector represents the target data (target vector) to be searched from a vector database. The query vector has the same dimension D as the vectors in the vector database. That is, like the vectors in the vector database, the query vector also includes D eigenvalues corresponding to each of the D dimensions. Hereinafter, the query vector will be simply referred to as the query.
[0036] The Approximate Nearest Neighbor Search System 1 performs an approximate nearest neighbor search on a vector database based on the received query. Approximate nearest neighbor search is a fast method for searching for vectors that are sufficiently close to the query (approximate nearest neighbor vectors) at a certain distance scale.
[0037] In this embodiment, the distance scale used to represent the distance between vectors can be, for example, Euclidean distance. In this case, basically, the Euclidean distance to the query (query vector) can be calculated for each of the search object vectors in the vector database, and the vector with the shortest Euclidean distance to the query is found among the search object vectors as the approximate nearest neighbor vector of the query.
[0038] Furthermore, the distance scale is not limited to Euclidean distance; it can be any other distance that can represent the distance between vectors.
[0039] Next, the configuration of the approximate nearest neighbor search system 1 will be described. The approximate nearest neighbor search system 1 includes a processor 11, a main memory 12, a communication interface 13, and a secondary storage device 14. The processor 11, the main memory 12, the communication interface 13, and the secondary storage device 14 are interconnected via a bus 10.
[0040] Processor 11 is, for example, a central processing unit (CPU). Processor 11 is capable of accessing main memory 12 and secondary storage device 14. Processor 11 performs various processes, including the creation of index information 22 (here, hybrid index information 22), the storage of index information to secondary storage device 14, and the searching of dataset 21, by executing computer programs (here, index creation program 121 and search program 122) stored in main memory 12. Hybrid index information 22 is a data structure used to search for target vectors (the approximate nearest neighbor vectors of the query) from dataset 21.
[0041] Main memory 12 is a low-latency storage device such as dynamic random access memory (DRAM). The storage areas of main memory 12 are used to store programs to be executed by processor 11, as well as the working area of processor 11.
[0042] Communication interface 13 is a communication device. Communication interface 13 performs communication with external device 2, for example, via communication path 3 such as a network or bus.
[0043] Secondary storage device 14 is a storage device with a larger capacity than main memory 12 and a slower access speed than main memory 12.
[0044] The approximate nearest neighbor search system 1 aims to realize a trillion-scale vector database capable of storing and managing a dataset 21 containing more than one trillion vectors. When constructing a trillion-scale vector database, the size of the dataset 21 and the index information 22 increases, making it difficult to store the index information 22 in the main memory 12. Therefore, in the approximate nearest neighbor search system 1, the dataset 21 and the index information 22 are each stored in the storage medium 141 of the secondary storage device 14. Alternatively, the dataset 21 and the index information 22 can be stored separately in multiple secondary storage devices 14. Or, the dataset 21 and the index information 22 can be divided into many data portions and stored dispersedly in many secondary storage devices 14.
[0045] The secondary storage device 14 can be implemented using a hard disk drive (HDD) or a solid-state drive (SSD). Hereinafter, we assume the secondary storage device 14 is implemented using an SSD.
[0046] An SSD is a memory system that includes non-volatile memory and a controller that controls the non-volatile memory.
[0047] Non-volatile memory comprises multiple blocks (also referred to as "memory blocks," "physical blocks," or "flash memory blocks"), each of which is a unit for data erasure operations. Each block comprises multiple pages, each of which is a unit for data write operations and data read operations. Non-volatile memory is, for example, NAND flash memory. NAND flash memory is, for example, a three-dimensional flash memory.
[0048] The controller is a memory controller with circuitry, such as an LSI (large-scale integrated circuit) implemented as a System-On-a-Chip (SoC).
[0049] Next, the functional structure of processor 11 will be explained.
[0050] The processor 11 functions as a cluster index creation unit 111, a graph index creation unit 112, and a search unit 113 by executing the index creation program 121 and the search program 122. Furthermore, the cluster index creation unit 111, the graph index creation unit 112, and the search unit 113 can each be implemented using dedicated hardware (circuit) within the near nearest neighbor search system 1.
[0051] The cluster index creation unit 111 creates and manages multiple clusters. Each cluster has a reference position. The reference position of each cluster is represented by a vector with the same dimension as the vectors in dataset 21. In other words, like the vectors in dataset 21, the reference position of a cluster is equivalent to a point in the data space (D-dimensional vector space), represented by a D-dimensional vector. Therefore, the reference position of each cluster will also be referred to as the reference vector of each cluster below.
[0052] For each of multiple clusters, the group of vectors closest to its reference position belongs to that cluster. The number of vectors belonging to a cluster is, for example, N. N is, for example, an integer greater than 2. When constructing a trillion-vector database, N could be, for example, 256. The relationship between each cluster and the groups of vectors belonging to each cluster is determined as follows.
[0053] For example, consider the scenario of managing cluster X with reference position x, cluster Y with reference position y, and cluster Z with reference position z.
[0054] In this case, vectors close to the reference position x are managed to belong to cluster X, vectors close to the reference position y are managed to belong to cluster Y, and vectors close to the reference position z are managed to belong to cluster Z.
[0055] The distance from each vector belonging to a certain cluster to the reference position of that cluster is shorter than the distance from each of the aforementioned vectors to the reference positions of other clusters. In other words, each vector in dataset 21 belongs to the cluster with the shortest distance from that vector to the reference position.
[0056] As the reference position for each cluster, for example, any vector belonging to that cluster can be used. In this case, the reference position of each cluster is equivalent to a representative point of multiple data points corresponding to multiple vectors belonging to that cluster, and is also called the cluster center.
[0057] The cluster index creation unit 111 creates cluster index information for specifying multiple clusters, each having a reference position (reference vector), and manages the created cluster index information.
[0058] Cluster-based indexing information is for each of multiple clusters and includes a list of belonging vectors. The list of belonging vectors corresponding to a particular cluster represents the identifiers of the vectors belonging to that cluster.
[0059] Additionally, cluster index information includes information representing the relative positional relationship between the reference vector and its constituent vectors within multiple clusters (relative positional information). This relative positional information includes, for example, distance information and orientation information. Distance information represents the distance between the reference vector and its constituent vectors. Orientation information represents the orientation from the reference vector to its constituent vectors.
[0060] In this embodiment, to reduce the computational cost and time required to search for approximate nearest neighbor vectors from more than one trillion vectors, multiple clusters can be managed as hierarchical clusters. In this case, the cluster index information includes information for managing multiple clusters as hierarchical clusters with a hierarchical cluster structure. Details of the hierarchical clusters will be discussed later. Figure 2 To be continued.
[0061] The graph index creation unit 112 generates graph index information and manages the generated graph index information. The graph index information contains information used to define the inter-cluster graph.
[0062] An inter-cluster graph is not a graph that connects vectors that are close to each other, but rather a graph that connects clusters that are close to each other. That is, an inter-cluster graph consists of multiple nodes corresponding to multiple clusters, and multiple edges that connect the two nodes corresponding to clusters that are close to each other at their reference positions.
[0063] Details of the structure of the inter-cluster graph are utilized Figure 3 Please provide an explanation.
[0064] Search unit 113 receives a query vector based on a query from external device 2 and performs an approximate nearest neighbor search on the vector database. In the approximate nearest neighbor search, search unit 113 uses hybrid index information 22, which includes clustered index information and graph index information, to search for the approximate nearest neighbor vector of the query from the dataset 21.
[0065] Next, the hybrid index structure, which includes hierarchical clusters (HC) and inter-cluster graphs (CG), will be explained. Figure 2 This is a diagram illustrating an example of a hybrid index structure.
[0066] Hierarchical clusters (HC) consist of multiple layers. These layers include a lowest-level layer and multiple higher-level layers. Figure 2 The example shown is a case where the lowest layer is layer L0 and there are multiple upper layers including layers L1, L2 and L3.
[0067] The lowest layer L0 comprises multiple lowest layer clusters. For each of these clusters, the group of vectors closest to its reference position belongs to that cluster. The multiple clusters described above correspond to the multiple lowest layer clusters included in the lowest layer L0.
[0068] exist Figure 2In the example shown in the lowest level L0, only three lowest level clusters CL1, CL2, and CL3 are illustrated. However, in reality, the lowest level L0 can include the number of lowest level clusters obtained by dividing the number of vectors in dataset 21 by N (the number of vectors in each cluster). Additionally, in Figure 2 The example shown is N = 5, but it can also be a finite number of natural numbers other than 5.
[0069] Vectors V1 to V5 belong to the lowest layer cluster CL1. Each of vectors V1 to V5 is a vector that is close to the reference position B0-1 of the lowest layer cluster CL1. The reference position (reference vector) B0-1 of the lowest layer cluster CL1 can also be set to be consistent with one of the vectors V1 to V5 (in this case, vector V2).
[0070] Vectors V6 to V10 belong to the lowest layer cluster CL2. Each of vectors V6 to V10 is a vector close to the reference position B0-2 of the lowest layer cluster CL2. The reference position (reference vector) B0-2 of the lowest layer cluster CL2 can also be set to be consistent with one of the vectors V6 to V10 (in this case, vector V7).
[0071] Vectors V11 to V15 belong to the lowest layer cluster CL3. Each of vectors V11 to V15 is a vector close to the reference position B0-3 of the lowest layer cluster CL3. The reference position (reference vector) B0-3 of the lowest layer cluster CL3 can also be set to be consistent with one of the vectors V11 to V15 (in this case, vector V14).
[0072] Within these lowest-level clusters, two lowest-level clusters with mutually close reference positions are connected by edges in the inter-cluster graph CG. Furthermore, in Figure 2 and Figure 3 The edges are represented by thick lines.
[0073] The N (in this case, 5) lowest-level clusters in the lowest-level cluster are grouped together and belong to one of the multiple upper-level clusters included in layer L1, the layer above the lowest-level cluster.
[0074] exist Figure 2 In the example shown, only two upper-level clusters, L1-CL1 and L1-CL2, from the multiple upper-level clusters included in layer L1 are presented. Upper-level clusters L1-CL1 and L1-CL2 each have reference positions B1-1 and B1-2, respectively.
[0075] For example, the lowest layer clusters CL1 to CL5 belong to the upper layer cluster L1-CL1. These lowest layer clusters CL1 to CL5 are called the lower layer clusters of the upper layer cluster L1-CL1. Each of the lowest layer clusters CL1 to CL5 is a lowest layer cluster with a reference position close to the reference position B1-1 of the upper layer cluster L1-CL1. The reference position (reference vector) B1-1 of the upper layer cluster L1-CL1 can also be set to coincide with the reference position of one of the lowest layer clusters CL1 to CL5 (in this case, the lowest layer cluster CL1).
[0076] N (in this case, 5) of the multiple upper-level clusters included in layer L1 are grouped together and belong to one of the multiple upper-level clusters included in layer L2.
[0077] exist Figure 2 In the example shown, only two upper-level clusters, L2-CL1 and L2-CL2, are shown among the multiple upper-level clusters included in layer L2. Upper-level clusters L2-CL1 and L2-CL2 each have reference positions B2-1 and B2-2, respectively.
[0078] For example, the upper-level clusters L1-CL1 to L1-CL5 of layer L1 are subordinate clusters of upper-level cluster L2-CL1 and belong to upper-level cluster L2-CL1. Each of the upper-level clusters L1-CL1 to L1-CL5 of layer L1 has a reference position close to the reference position B2-1 of the upper-level cluster L2-CL1 of layer L2. The reference position (reference vector) B2-1 of the upper-level cluster L2-CL1 of layer L2 can also be set to be consistent with the reference position of one of the upper-level clusters L1-CL1 to L1-CL5 (in this case, upper-level cluster L1-CL1).
[0079] The N (in this case, 5) super-layer clusters included in layer L2, the layer above layer L1, are grouped together and belong to one super-layer cluster (superior layer cluster) L3-CL included in layer L3 (the uppermost layer).
[0080] The upper-level clusters L2-CL1 to L2-CL5 of layer L2 are subordinate clusters of the uppermost cluster L3-CL and thus belong to the uppermost cluster L3-CL. Each of the upper-level clusters L2-CL1 to L2-CL5 of layer L2 has a reference position close to the reference position B3-1 of the uppermost cluster L3-CL. The reference position (reference vector) B3-1 of the uppermost cluster L3-CL can also be set to be consistent with the reference position of one of the upper-level clusters L2-CL1 to L2-CL5 (in this case, the upper-level cluster L2-CL1).
[0081] In this way, multiple clusters belonging to groups that each have vectors are managed using a hierarchical cluster structure (i.e., hierarchical cluster HC) that includes the lowest level and multiple upper levels.
[0082] Furthermore, the number of lower-level clusters belonging to each higher-level cluster may change due to the addition or deletion of lower-level clusters. A higher-level cluster whose number of lower-level clusters becomes zero may also be deleted. Therefore, more than one lower-level cluster belongs to each higher-level cluster. Additionally, the number of vectors belonging to each lowest-level cluster changes due to the addition of vectors to dataset 21 or the deletion of vectors from dataset 21. A lowest-level cluster whose number of vectors becomes zero may also be deleted. Therefore, more than one vector belongs to each lowest-level cluster.
[0083] Next, consider the scenario of building a trillion-level vector database. In this case, N can also be set to hundreds, such as 256.
[0084] For each lowest-level cluster CL of the lowest-level layer L0, there are 256 vectors V belonging to that lowest-level cluster CL.
[0085] Each of the 256 vectors V belongs to one of the 256 lowest-level clusters CL, which are subordinate clusters of a higher-level cluster L1-CL within layer L1. Therefore, the number of vectors V that can be managed by each higher-level cluster L1-CL within layer L1 is 256. 2 .
[0086] Each of the 256 lower-level clusters (256 lowest-level clusters CL) belongs to one of the 256 upper-level clusters L1-CL, which in turn are lower-level clusters of an upper-level cluster L2-CL within layer L2. Therefore, the number of vectors that can be managed by each upper-level cluster L2-CL within layer L2 becomes 256. 3 .
[0087] Each of the 256 lower-level clusters (256 upper-level clusters L1-CL) belongs to one of the 256 upper-level clusters L2-CL, which in turn are lower-level clusters of an upper-level cluster L3-CL within layer L3. Therefore, the number of vectors that can be managed by an upper-level cluster L3-CL within layer L3 becomes 256. 4 .
[0088] Thus, whenever the layer level increases by 1, the total number of vectors that can be managed increases to 256 (=2^3). 8 Therefore, by setting the total number of layers included in the hierarchical cluster HC to a number corresponding to the size of the vector database being constructed, it is possible to construct a large-scale vector database exceeding one trillion. For example, with the total number of layers set to 8, it can manage a maximum of 2... 64 (=2 8×8 ) vectors.
[0089] Figure 2The hybrid index information 22 corresponding to the hierarchical cluster HC shown in the diagram can also include, for example, the following for each upper-level cluster: (1) a list of lower-level clusters representing the identifiers of their respective lower-level clusters belonging to the upper-level cluster; (2) relative position information (first relative position information) representing the positional relationship between the reference position of the upper-level cluster and the reference positions of each lower-level cluster belonging to the upper-level cluster; (3) a list of same-level clusters representing the identifiers of their respective same-level clusters corresponding to the upper-level cluster; and (4) relative position information (second relative position information) representing the positional relationship between the reference position of the upper-level cluster and the reference positions of each same-level cluster corresponding to the upper-level cluster. Here, the same-level cluster corresponding to a certain upper-level cluster is other clusters included in the same layer as the layer that includes the upper-level cluster.
[0090] The first relative position information may include, for example, either or both of distance information, which indicates the distance between the reference position of the upper layer cluster and the reference position of each lower layer cluster, and position information, which indicates the orientation from the reference position of the upper layer cluster to the reference position of each lower layer cluster.
[0091] The second relative position information may include, for example, either or both of distance information, which indicates the distance between the reference position of the upper-level cluster and the reference positions of each cluster in the same level, and position information, which indicates the orientation from the reference position of the upper-level cluster to the reference positions of each cluster in the same level.
[0092] This relative position information (first relative position information and second relative position information) is information obtained in advance through calculation or other means. By using the relative position information (first relative position information and second relative position information), it is possible to efficiently search for the cluster with the closest reference position to the query from multiple lower-level clusters belonging to the higher-level cluster. Details of the search process using the relative position information (first relative position information and second relative position information) will be described later.
[0093] Additionally, the hybrid index information 22 corresponding to the hierarchical cluster HC can also include, for example, the following for each lowest-level cluster: (1) a list of vectors to which the identifiers of the vectors belonging to the lowest-level cluster belong; (2) relative position information (third relative position information) indicating the positional relationship between the reference position of the lowest-level cluster and each vector belonging to the lowest-level cluster; (3) relative position information indicating the positional relationship between vectors belonging to the lowest-level cluster (fourth relative position information); (4) a list of auxiliary reference positions set in the lowest-level cluster; and (5) relative position information indicating the positional relationship between each auxiliary reference position set in the lowest-level cluster and each vector belonging to the lowest-level cluster (fifth relative position information). An auxiliary reference position is an auxiliary reference position set within the lowest-level cluster that differs from the reference position of the lowest-level cluster. The auxiliary reference position is represented by a vector having the same dimension as the vectors in the dataset 21. In other words, similar to the vectors in dataset 21, the auxiliary reference position is equivalent to a point in the data space (D-dimensional vector space), represented by a D-dimensional vector. Therefore, the auxiliary reference position will also be referred to as the auxiliary reference vector below. For example, any vector belonging to the corresponding lowest-level cluster can be used as the auxiliary reference position.
[0094] The third relative position information may include either or both of the following: distance information representing the distance between the reference position of the lowest layer cluster and each vector, and orientation information representing the orientation from the reference position of the lowest layer cluster to each vector.
[0095] The fourth relative position information may include either or both of the following: distance information, which indicates the relative position between vectors belonging to the same lowest-level cluster and the distance between a vector and other vectors; and orientation information, which indicates the orientation from a vector to other vectors.
[0096] The fifth relative position information may include either or both of the following: distance information representing the distance between each auxiliary reference position of the lowest layer cluster and each vector, and orientation information representing the orientation from each auxiliary reference position of the lowest layer cluster to each vector.
[0097] This relative position information (the third, fourth, and fifth relative position information) is information obtained in advance through calculation or other means. By using this relative position information, it is possible to efficiently search for the vector closest to the query within the vectors of the lowest-level cluster belonging to the search object. Details of the search processing using this relative position information will be described later.
[0098] Furthermore, the hybrid index information 22 corresponding to the hierarchical cluster HC can also include, for each lowest-level cluster: (6) relative position information (6th relative position information) indicating the positional relationship between the reference position of the lowest-level cluster and the reference positions of each cluster in the same level corresponding to the lowest-level cluster; (7) an adjacent list indicating the identifiers of the adjacent clusters connected to the lowest-level cluster by edges; and (8) relative position information (7th relative position information) indicating the positional relationship between the reference position of the lowest-level cluster and the reference positions of each adjacent cluster corresponding to the lowest-level cluster.
[0099] The sixth relative position information may include either or both of the following: distance information, which indicates the distance between the reference position of the lowest layer cluster and the reference positions of each cluster in the same layer, and orientation information, which indicates the orientation from the reference position of the lowest layer cluster to the reference positions of each cluster in the same layer.
[0100] The 7th relative position information may include either or both of the following: distance information, which represents the distance between the reference position of the lowest layer cluster and the reference positions of each adjacent cluster corresponding to the lowest layer cluster; and orientation information, which represents the orientation from the reference position of the lowest layer cluster to the reference positions of each adjacent cluster corresponding to the lowest layer cluster.
[0101] This relative position information (the 6th and 7th relative position information) is information obtained in advance through calculation or other means. By using this relative position information, it is possible to efficiently search for the lowest-level cluster with the closest reference position to the query from the lowest-level cluster of a certain upper-level cluster belonging to layer L1.
[0102] Next, an example of search processing using hierarchical clusters (HC) and inter-cluster graphs (CG) will be explained. Figure 3 This is a diagram illustrating an example of search processing performed in an approximate nearest neighbor search system 1 using a hybrid index structure.
[0103] Based on the query (query vector) Q received from the external device 2, the processor 11 begins a search process to search for the approximate nearest neighbor vector of query Q from the dataset 21.
[0104] The search process includes: (1) an approximate nearest neighbor cluster search process for searching the lowest-level cluster (approximate nearest neighbor cluster) that has the closest reference position to the query Q; and (2) an approximate nearest neighbor vector search process for searching the approximate nearest neighbor vector of the query Q from the group of vectors belonging to the approximate nearest neighbor cluster. Furthermore, the approximate nearest neighbor vector search process can also be a process of searching the approximate nearest neighbor vector of the query Q from the group of vectors belonging to the approximate nearest neighbor cluster and the group of vectors belonging to one or more lowest-level clusters that are close to the approximate nearest neighbor cluster.
[0105] The near nearest neighbor cluster search process starts from the top layer L3.
[0106] Processor 11 sets the top-level cluster L3-CL as the target cluster for the approximate nearest neighbor cluster search. Processor 11 finds the lower-level cluster with the closest reference position to query Q from the lower-level clusters belonging to the top-level cluster L3-CL (here, the upper-level clusters L2-CL1 to L2-CL5 of layer L2). Figure 3 In the above-top cluster L3-CL, the lower-level cluster with the shortest reference position to query Q among the lower-level clusters (the upper-level clusters L2-CL1 to L2-CL5 of layer L2) is the upper-level cluster L2-CL1. Therefore, the upper-level cluster L2-CL1 is found as the lower-level cluster belonging to the above-top cluster L3-CL and having the reference position closest to query Q.
[0107] When the upper-level cluster L2-CL1 is found to be a lower-level cluster belonging to the highest-level cluster L3-CL and having the reference position closest to query Q, the processor 11 sets the upper-level cluster L2-CL1 as the new object cluster. The processor 11 then finds the lower-level cluster with the reference position closest to query Q from the lower-level clusters belonging to the upper-level cluster L2-CL1 (here, the upper-level clusters L1-CL1 to L1-CL5 of layer L1). Figure 3 In the above, the lower-level cluster (L1-CL1 to L1-CL5, the upper-level clusters of layer L1) that has the shortest reference position to query Q is the upper-level cluster L1-CL1. Therefore, the upper-level cluster L1-CL1 is found as the lower-level cluster that belongs to the upper-level cluster L2-CL1 and has the closest reference position to query Q.
[0108] When the upper-level cluster L1-CL1 is found to be a lower-level cluster belonging to the upper-level cluster L2-CL and having the reference position closest to query Q, the processor 11 sets the upper-level cluster L1-CL1 as the new object cluster. The processor 11 then finds the lower-level cluster with the reference position closest to query Q from the lower-level clusters belonging to the upper-level cluster L1-CL1 (here, the lowest-level clusters CL1-CL5 of layer L0). Figure 3 In the above-level clusters L1-CL1, the lowest-level cluster CL3 is the lowest-level cluster that has the shortest reference position to the query Q among the lower-level clusters (CL1-CL5 of layer L0). Therefore, the lowest-level cluster CL3 is found as the lower-level cluster belonging to the upper-level clusters L1-CL1 and having the reference position closest to the query Q. The lowest-level cluster CL3 is determined to be the approximate nearest neighbor cluster, i.e., the search starting cluster used for approximate nearest neighbor vector search processing.
[0109] Thus, in the approximate nearest neighbor cluster search process, the search process for finding the lower-level cluster with the reference position closest to the query Q is repeatedly performed for each layer until one of the multiple lower-level clusters CL is found as the lower-level cluster with the reference position closest to the query Q. Moreover, the lower-level cluster with the reference position closest to the query Q among the multiple lower-level clusters CL is determined as the approximate nearest neighbor cluster.
[0110] When the lowest-level cluster CL3 is determined to be the approximate nearest neighbor cluster, the processor 11 performs a search for the approximate nearest neighbor cluster (in this case, the lowest-level cluster CL3), finding the vector closest to query Q among the vectors V11 to V15 belonging to the lowest-level cluster CL3 as the search result (approximate nearest neighbor vector). The search result (approximate nearest neighbor vector) is sent back to the external device 2 as a response to query Q.
[0111] Furthermore, the processor 11 may also designate the lowest-level cluster CL with the reference position closest to query Q as the search start cluster. In this case, the processor 11 performs a search for one or more search object clusters (e.g., lowest-level clusters CL1, CL2, ...) that are close to the search start cluster (here, the lowest-level cluster CL3) while traversing the inter-cluster graph CG. For each of the search object clusters, the processor 11 finds the vector closest to query Q among the vectors belonging to the search object cluster as the nearest neighbor vector within the search object cluster.
[0112] Then, processor 11 outputs the nearest neighbor vector found from the search start cluster (lowest-level cluster CL3) and the vector closest to query Q from the nearest neighbor vectors found from more than one search object cluster (e.g., lowest-level clusters CL1, CL2, ...) as the search result (approximate nearest neighbor vector). In this case, the search result (approximate nearest neighbor vector) is sent back to external device 2 as a response to query Q.
[0113] Furthermore, the search process for finding the nearest lower-level cluster to query Q for each higher-level cluster can be performed using pre-obtained relative position information, such as through prior calculation.
[0114] Next, an example illustrating the principle of approximate nearest neighbor vector search using the distance and orientation between vectors will be given. Figure 4A , Figure 4B , Figure 4C as well as Figure 4D This is a diagram illustrating the principle of approximate nearest neighbor vector search using distance and orientation between vectors.
[0115] Here, we envision receiving a query Q1 based on a query from external device 2, and setting a first temporary (provisional) nearest neighbor 401 that is assumed to be close to query Q1. The first temporary nearest neighbor 401 is, for example, any vector included in dataset 21 (vector database). This arbitrary vector can be, for example, a vector with a specific ID among multiple vectors included in dataset 21, or a vector randomly selected from these multiple vectors. Furthermore, each of these multiple vectors belongs to any one of the multiple lowest-level clusters CL of the hierarchical cluster HC. If the approximate nearest neighbor cluster for query Q1 is determined among the multiple lowest-level clusters CL, the reference vector of the approximate nearest neighbor cluster can also be used as the first temporary nearest neighbor 401. The approximate nearest neighbor cluster is the lowest-level cluster with the reference vector closest to query Q1. The following example illustrates the case of obtaining the approximate nearest neighbor vector from N vectors (D-dimensional vectors) belonging to the approximate nearest neighbor cluster. That is, the vectors of the search object are N vectors.
[0116] First, such as Figure 4A As shown, the search unit 113 calculates the distance Ln1 between the first temporary nearest neighbor 401 and the query Q1. The distance between vectors calculated by the search unit 113 is, for example, Euclidean distance. In this case, ideally, it is desirable to search for vectors within a radius 402 centered on the query Q1 with a radius Ln1. In other words, it is desirable to exclude vectors outside the range 402 from the N vectors of the search object. However, the distance between the query Q1 and each vector is unknown before calculation. Therefore, in order to determine whether each vector is inside or outside the range 402, the distance between the query Q1 and each vector must be calculated, increasing the computational load.
[0117] Therefore, as Figure 4B As shown, the search unit 113 determines a search range 403 with a radius of 2Ln1 centered on the first temporary nearest neighbor 401. Vectors within the search range 403 may be closer to query Q1 than the first temporary nearest neighbor 401.
[0118] The distances between vectors are calculated in advance (i.e., calculated before receiving query Q1). Specifically, for example, the distances between the first temporary nearest neighbor 401 and the respective vectors of the search object are calculated in advance.
[0119] The search unit 113 can determine whether each vector of the search object is within the search range 403 based on the pre-calculated distance between vectors. Therefore, the search unit 113 can exclude M vectors outside the search range 403 from the N vectors of the search object. M is, for example, an integer greater than or equal to 1.
[0120] The search range of 403 contains (NM) vectors. Figure 4CIn the example shown, the search range 403 contains five vectors 411 to 415. The search unit 113 can determine that all five vectors 411 to 415 are within the search range 403 based on the pre-calculated distance between the vectors.
[0121] In addition, the search unit 113 calculates the orientation information α1, which represents the orientation from the first temporary nearest neighbor 401 to the query Q1. The search unit 113 searches sequentially within the search range 403, focusing on a specific orientation range 404 centered on the orientation information α1, starting from the location closest to the orientation information α1.
[0122] The orientation information between vectors is calculated in advance. Specifically, for example, the orientation information representing the orientation from the first temporary nearest neighbor point 401 to vectors 411-415 is calculated in advance. Furthermore, the specific calculation methods for the orientation information and the deviation between the two orientation information (orientation deviation) will be described later.
[0123] Based on pre-calculated distances and orientation information between vectors, the search unit 113 obtains vectors 411 corresponding to orientation information α1 and distance Ln1 with a similarity of at least a first threshold. Specifically, the search unit 113, for example, obtains vectors 411 that are within the search range 403 and correspond to orientation information α1 with a similarity of at least a second threshold. Furthermore, when using Hamming distance as the similarity (degree of orientation deviation) between orientation information, the search unit 113, for example, obtains vectors 411 that are within the search range 403 and correspond to orientation information α1 with a Hamming distance of at least a third threshold. In other words, the search unit 113 obtains (NP) vectors by excluding P vectors outside the search range 403 and P vectors corresponding to orientation information α1 with a Hamming distance exceeding the third threshold from the N vectors of the search target. P is, for example, an integer greater than or equal to 1. The search unit 113 obtains vector 411 from these (NP) vectors.
[0124] The search unit 113 calculates the distance Ln2 between the obtained vector 411 and the query Q1. The search unit 113 determines whether the distance Ln2 is less than the distance Ln1. Here, since the distance Ln2 is less than the distance Ln1, the search unit 113 sets the vector 411 as the second temporary nearest neighbor 411.
[0125] In this case, ideally, we would like to search for vectors within a radius Ln2 of 405 centered on query Q1. In other words, we would like to exclude vectors outside the range 405 from the vectors in the search. However, as mentioned above, the distances between query Q1 and each vector (e.g., vectors 412–415 each) are unknown before calculation.
[0126] Therefore, as Figure 4D As shown, the search unit 113 determines a search range 406 with a radius of 2Ln2 centered on the second temporary nearest neighbor 411. Vectors within the search range 406 may be closer to the query Q1 than the second temporary nearest neighbor 411. The search unit 113 can determine whether each vector of the search object is within the search range 406 based on the pre-calculated distance between vectors. Thus, the search unit 113 can exclude vectors outside the search range 406 from the vectors of the search object.
[0127] Furthermore, the search unit 113 determines a search range 409 obtained by removing range 408 from range 407. Range 407 is a range centered on the first temporary nearest neighbor 401 with a radius of (Ln1+Ln2), which is the distance obtained by adding distance Ln1 to distance Ln2. Range 408 is a range centered on the first temporary nearest neighbor 401 with a radius of (Ln1-Ln2), which is the distance obtained by subtracting distance Ln2 from distance Ln1. Vectors within search range 409 may be closer to query Q1 than the second temporary nearest neighbor 411. The search unit 113 can determine whether each vector of the search object is within search range 409 based on the pre-calculated distance between vectors. Thus, the search unit 113 can exclude vectors outside search range 409 from the vectors of the search object. For example, the search unit 113 can obtain (NML-1) vectors of the search object by excluding the second temporary nearest neighbor 411 (vector 411) and L vectors outside the search range 409 from the (NM) vectors of the search object. L is, for example, an integer greater than or equal to 1.
[0128] Furthermore, the search unit 113 determines the search range 410 where search range 406 and search range 409 overlap. Vectors within search range 410 may be closer to query Q1 than the second temporary nearest neighbor 411. The search unit 113 can determine whether each vector of the search object is within search range 410 based on pre-calculated distances between vectors, i.e., based on the distances between the first temporary nearest neighbor 401 and each vector and the distances between the second temporary nearest neighbor 411 and each vector. Thus, the search unit 113 can exclude vectors outside search range 410 from the vectors of the search object.
[0129] Similar to the aforementioned processing of the second temporary nearest neighbor 411, if there is a vector within the search range 410 that has not been searched and whose distance to query Q1 is shorter than its distance Ln2, the search unit 113 sets this vector as a new temporary nearest neighbor and further narrows the search range, performing a process to search for vectors within the search range. The search unit 113 repeats this process, for example, until there are no unsearched vectors within the narrowed search range. Furthermore, unsearched vectors are those whose distance to the query has not yet been calculated (evaluated).
[0130] If there are no unsearched vectors within the search range, the search unit 113 outputs the vector that was last set as the temporary nearest neighbor as the approximate nearest neighbor vector. For example, if there are no unsearched vectors within the search range 410, or if there are no vectors within the search range 410 whose distance from query Q1 is shorter than its distance from Ln2, the search unit 113 outputs the vector 411 that was set as the second temporary nearest neighbor 411 as the approximate nearest neighbor vector.
[0131] Based on the above principle of approximate nearest neighbor vector search, the search unit 113 can use the pre-calculated distance and orientation between vectors to narrow the search range of vectors and efficiently search for approximate nearest neighbor vectors.
[0132] Here, an example of a method for calculating the orientation information from one vector (the first vector) to another vector (the second vector) will be explained. The first vector and the second vector are, for example, any one of the following: a reference vector, an auxiliary reference vector, the vectors included in dataset 21, and a query vector.
[0133] Search unit 113 uses the difference vector (vector difference) obtained by subtracting the first vector from the second vector to compress the azimuth information represented by the difference vector, thereby calculating the azimuth information. This difference vector includes D differences obtained by subtracting the D elements of the first vector from the D elements of the second vector. More specifically, search unit 113 obtains R partial vectors from the difference vector. That is, search unit 113 divides the difference vector into R partial vectors. R is, for example, an integer greater than 2. Search unit 113 converts (encodes) each of the R partial vectors into R bit values. Search unit 113 calculates (generates) a data string containing R bit values as the azimuth information.
[0134] Furthermore, if the first and second vectors are D-dimensional vectors, the difference vector is also D-dimensional. Therefore, each of the R partial vectors contains D / R elements (eigenvalues). For example, if the difference vector is a 2048-dimensional vector and the number of partial vectors R is 32, each of the 32 partial vectors contains 64 (=2048 / 32) elements.
[0135] Regarding methods for converting a partial vector into a bit value (a 1-bit numerical value), the following four examples (1) to (4) are shown.
[0136] (1) If the number of elements greater than 0 (the number of first elements) in the D / R elements included in a partial vector is greater than the number of elements less than 0 (the number of second elements), the partial vector is converted to the bit value "1". If the number of first elements is less than the number of second elements, the partial vector is converted to the bit value "0".
[0137] (2) If one of the D / R elements in a partial vector is 0 or higher, the partial vector is converted to a bit value "1". If one of the elements is less than 0, the partial vector is converted to a bit value "0". An element is an element selected from the D / R elements according to certain rules. Specifically, an element is, for example, the element with a specific sequence number (e.g., the 3rd) among the D / R elements.
[0138] (3) If the absolute value of the sum of the positive elements (the absolute value of the first sum) is greater than the absolute value of the sum of the negative elements (the absolute value of the second sum) in the D / R elements included in the partial vector, the partial vector is converted to the bit value "1". If the absolute value of the first sum is less than the absolute value of the second sum, the partial vector is converted to the bit value "0".
[0139] (4) If the sum of squares of the positive elements (the first sum of squares) among the D / R elements included in the partial vector is greater than the sum of squares of the negative elements (the second sum of squares), then the partial vector is converted to the bit value "1". If the first sum of squares is less than or equal to the second sum of squares, then the partial vector is converted to the bit value "0".
[0140] In addition, the azimuth deviation (azimuth difference) between a certain azimuth information (first azimuth information) and another azimuth information (second azimuth information) is represented, for example, by the Hamming distance between the first azimuth information and the second azimuth information.
[0141] The Hamming distance between two azimuth information points is represented by the number of different bits when comparing each bit sequentially between the two R-bit data strings corresponding to the two azimuth information points. Therefore, the Hamming distance between the azimuth information points of the two vectors is any value from 0 to R. The search unit 113 obtains the Hamming distance between the azimuth information points of the two vectors, for example, by performing an XOR operation on the two R-bit data strings and counting the number of bits with a value of 1.
[0142] Using the above method, in the approximate nearest neighbor vector search system 1, it is possible to calculate the azimuth information from one vector to another, as well as the azimuth deviation between the two azimuth information.
[0143] Furthermore, the approximate nearest neighbor vector search can also be performed using only the distance between vectors. Figure 5A , Figure 5B as well as Figure 5C This is a diagram illustrating the principle of approximate nearest neighbor vector search using the distance between vectors.
[0144] Here, we envision receiving a query Q2 based on a query from external device 2, and obtaining a temporary nearest neighbor and its distance Ln through a search of any cluster (the lowest-level cluster) based on query Q2. Then, we designate another cluster as the object cluster and further perform an approximate nearest neighbor vector search. The temporary nearest neighbor distance Ln is the distance between the temporary nearest neighbor and query Q2. N vectors belong to the object cluster. Within the object cluster, a reference point B1 (reference vector B1) is defined, and the distances between vectors are pre-calculated.
[0145] like Figure 5A As shown, the search unit 113 calculates the distance Lc between the reference point B1 of the object cluster and the query Q2. The distance Lc is longer than the temporary nearest neighbor distance Ln. Ideally, in this case, it would be desirable to search for vectors within a radius 501 centered on the query Q2. However, the distances between the query Q2 and each vector belonging to the object cluster are unknown before calculation. Therefore, to determine whether each vector is inside or outside the range 501, the distances between the query Q2 and each vector must be calculated, increasing the computational load.
[0146] Therefore, as Figure 5B As shown, the search unit 113 determines a search range 504 obtained by subtracting range 503 from range 502. Range 502 is a range centered on the reference point B1 with a radius of (Lc+Ln), which is the distance obtained by adding the temporary nearest neighbor distance Ln to the distance Lc. Range 503 is a range centered on the reference point B1 with a radius of (Lc-Ln), which is the distance obtained by subtracting the temporary nearest neighbor distance Ln from the distance Lc. Search range 504 is a range centered on the reference point B1 that includes all vectors whose distance from query Q2 may be less than the temporary nearest neighbor distance Ln.
[0147] Next, as Figure 5C As shown, the search unit 113 selects vector 505 that falls within the search range 504 from the N vectors belonging to the object cluster. The search unit 113 calculates the distance Ln2 between vector 505 and query Q2. The search unit 113 determines whether the distance Ln2 is less than the temporary nearest neighbor distance Ln. Here, since the distance Ln2 is less than the temporary nearest neighbor distance Ln, the search unit 113 sets vector 505 as the new temporary nearest neighbor. In addition, the search unit 113 sets the distance Ln2 as the new temporary nearest neighbor distance.
[0148] Search unit 113 determines a search range 509 obtained by removing range 507 from range 508. Range 508 is a range centered on reference point B1 with a radius of (Lc+Ln2), which is the distance obtained by adding the temporary nearest neighbor distance Ln2 to the distance Lc. Range 507 is a range centered on reference point B1 with a radius of (Lc-Ln2), which is the distance obtained by subtracting the temporary nearest neighbor distance Ln2 from the distance Lc. Search range 509 includes all vectors whose distance from query Q2 may be less than the temporary nearest neighbor distance Ln2. Search unit 113 can determine whether each vector is within search range 509 based on the pre-calculated distance between reference point B1 and each vector. Thus, search unit 113 can exclude vectors outside search range 509 from the vectors of the search target.
[0149] Furthermore, the search unit 113 determines a search range 510 with a radius of 2Ln2 centered on the temporary nearest neighbor 505. Vectors within the search range 510 may be closer to query Q2 than the temporary nearest neighbor 505. The search unit 113 can determine whether each vector of the search object is within the search range 510 based on the pre-calculated distance between vectors. Thus, the search unit 113 can exclude vectors outside the search range 510 from the vectors of the search object.
[0150] Furthermore, the search unit 113 determines the search range 511 where the search range 509 and search range 510 overlap. Vectors within the search range 511 may be closer to query Q2 than the temporary nearest neighbor 505. The search unit 113 can determine whether each vector of the search object is within the search range 511 based on pre-calculated distances between vectors, i.e., based on the distance between the reference point B1 and each vector and the distance between the temporary nearest neighbor 505 and each vector. Thus, the search unit 113 can exclude vectors outside the search range 511 from the vectors of the search object.
[0151] If the search unit 113 finds a vector within the search range 511 that has not been searched and whose distance to query Q2 is shorter than the temporary nearest neighbor distance Ln, it sets that vector as a new temporary nearest neighbor and further narrows the search range, performing a process to search for vectors within the narrowed search range. The search unit 113 repeats this process, for example, until there are no unsearched vectors within the search range.
[0152] If there are no unsearched vectors within the search range, or if any unsearched vector within the search range is at least within the temporary nearest neighbor distance of query Q2, the search unit 113 outputs the vector that was last set as the temporary nearest neighbor as the approximate nearest neighbor vector. Figure 5CIn the example shown, if there are no unsearched vectors within the search range 511, and if the distance between any unsearched vector within the search range 511 and query Q2 is greater than or equal to the temporary nearest neighbor distance Ln2, the search unit 113 outputs the vector 505, which is finally set as the temporary nearest neighbor, as the approximate nearest neighbor vector.
[0153] Based on the above principle of approximate nearest neighbor vector search, the search unit 113 can use the pre-calculated distance between vectors to narrow the search range of vectors and efficiently search for approximate nearest neighbor vectors.
[0154] In addition, multiple reference points (reference vectors) can be set in an object cluster. Figure 6 This is another example of a diagram used to illustrate the principle of approximate nearest neighbor vector search using the distance between vectors.
[0155] and Figures 5A to 5C Similarly, in the example shown, imagine receiving a query-based query Q2 from external device 2, and obtaining a temporary nearest neighbor and a temporary nearest neighbor distance Ln through a search of any cluster (the lowest-level cluster) based on query Q2. Then, another cluster is set as the object cluster, and an approximate nearest neighbor vector search is performed further. In the object cluster, three reference points B1, B2, and B3 (reference vectors B1, B2, and B3) are set, and the distances between the vectors are calculated in advance.
[0156] like Figure 6 As shown, the search unit 113 calculates the distance Lc1 between the reference point B1 and the query Q2. The search unit 113 calculates the distance Lc2 between the reference point B2 and the query Q2. The search unit 113 calculates the distance Lc3 between the reference point B3 and the query Q2. Distances Lc1, Lc2, and Lc3 are all longer than the temporary nearest neighbor distance Ln. In this case, ideally, it is desirable to search for vectors within a radius 551 centered on the query Q2. However, the distances between the query Q2 and each vector belonging to the object cluster are unknown before calculation. Therefore, in order to determine whether each vector is inside or outside the range 551, the distances between the query Q2 and each vector must be calculated, increasing the computational load.
[0157] Therefore, the search unit 113 determines a search range 554 obtained by removing range 553 from range 552. Range 552 is a range centered on the reference point B1 with a radius of (Lc1+Ln), which is the distance obtained by adding the temporary nearest neighbor distance Ln to the distance Lc1. Range 553 is a range centered on the reference point B1 with a radius of (Lc1-Ln), which is the distance obtained by subtracting the temporary nearest neighbor distance Ln from the distance Lc1. Search range 554 is a range centered on the reference point B1 that includes vectors whose distance from query Q2 may be less than the temporary nearest neighbor distance Ln. The search unit 113 can determine whether each vector is within search range 554 based on the pre-calculated distance between the reference point B1 and each vector. Thus, the search unit 113 can exclude vectors outside search range 554 from the vectors of the search target.
[0158] Search unit 113 determines a search range 557 obtained by removing range 556 from range 555. Range 555 is a range centered on reference point B2 with a radius of (Lc2+Ln), which is the distance obtained by adding the temporary nearest neighbor distance Ln to the distance Lc2. Range 556 is a range centered on reference point B2 with a radius of (Lc2-Ln), which is the distance obtained by subtracting the temporary nearest neighbor distance Ln from the distance Lc2. Search range 557 includes vectors whose distance from query Q2 may be less than the temporary nearest neighbor distance Ln, centered on reference point B2. Search unit 113 can determine whether each vector is within search range 557 based on the pre-calculated distance between reference point B2 and each vector. Thus, search unit 113 can exclude vectors outside search range 557 from the vectors of the search target.
[0159] Search unit 113 determines a search range 560 obtained by removing range 559 from range 558. Range 558 is a range centered on reference point B3 with a radius of (Lc3+Ln), which is the distance obtained by adding the temporary nearest neighbor distance Ln to the distance Lc3. Range 559 is a range centered on reference point B3 with a radius of (Lc3-Ln), which is the distance obtained by subtracting the temporary nearest neighbor distance Ln from the distance Lc3. Search range 560 includes vectors whose distance from query Q2 may be less than the temporary nearest neighbor distance Ln, centered on reference point B3. Search unit 113 can determine whether each vector is within search range 560 based on the pre-calculated distance between reference point B3 and each vector. Thus, search unit 113 can exclude vectors outside search range 560 from the vectors of the search target.
[0160] Furthermore, the search unit 113 determines the search range 554, the search range 557, and the search range 561 where the search range 560 overlaps. The search unit 113 can determine whether each vector of the search object is within the search range 561 based on pre-calculated distances between vectors, specifically the distances between reference point B1 and each vector, the distances between reference point B2 and each vector, and the distances between reference point B3 and each vector. Thus, the search unit 113 can exclude vectors outside the search range 561 from the vectors of the search object.
[0161] If the search unit 113 finds a vector within the search range 561 that has not been searched and whose distance to query Q2 is shorter than the temporary nearest neighbor distance Ln, it sets that vector as a new temporary nearest neighbor, sets the distance between that vector and query Q2 as a new temporary nearest neighbor distance, and further narrows the search range, performing a process to search for vectors within the narrowed search range. The search unit 113 repeats this process, for example, until there are no unsearched vectors within the search range.
[0162] If there are no unsearched vectors within the search range, or if any vector within the search range is at or above the temporary nearest neighbor distance from query Q2, the search unit 113 outputs the vector that was last set as the temporary nearest neighbor as the approximate nearest neighbor vector.
[0163] Based on the above principle of approximate nearest neighbor vector search, the search unit 113 can use the pre-calculated distances between multiple reference points B1, B2 and B3 and each vector to narrow the search range of the vector and efficiently search for approximate nearest neighbor vectors.
[0164] In addition, refer to Figures 4A to 6 The principle of the approximate nearest neighbor vector search can also be applied to the approximate nearest neighbor cluster search.
[0165] Next, refer to Figures 7-11 Specifically, examples of approximate nearest neighbor cluster search and approximate nearest neighbor vector search are given when a query-based query Q is received from external device 2.
[0166] Figure 7 This illustrates an example of an approximate nearest neighbor cluster search in the approximate nearest neighbor search system 1, which uses the distance between reference points (reference vectors) and the orientation between reference points. The search unit 113, for example, starts from the highest level and, for each level, sets the reference point of the upper level as the starting point, and searches for approximate nearest neighbor clusters from one or more lower level clusters belonging to that upper level. These approximate nearest neighbor clusters are, for example, used as the object clusters for the approximate nearest neighbor vector search.
[0167] Here, we illustrate the case where a reference point B of a certain upper layer is set as the starting point, and the search for the nearest neighbor cluster is performed among the nine lower layer clusters belonging to that upper layer. Each of the nine lower layer clusters has reference points 611 to 619. The reference points 611 to 619 of the lower layer clusters are also referred to as lower layer reference points 611 to 619.
[0168] The distances between the upper-level reference point B and the lower-level reference points 611-619 are calculated in advance. The azimuth information indicating the directions from the upper-level reference point B to the lower-level reference points 611-619 is calculated in advance. The distances between the lower-level reference points 611-619 are calculated in advance. Furthermore, the azimuth information indicating the mutual directions among the lower-level reference points 611-619 is calculated in advance.
[0169] First, the search unit 113 calculates the distance Ln1 between the reference point B and the query Q. The search unit 113 can also set a search range 601 with a radius of 2Ln1 centered on the reference point B. Figure 7 In the example shown, the search range 601 contains 7 lower-level clusters. More specifically, the search range 601 contains 7 lower-level reference points 611, 613, 614, 615, 617, 618, and 619.
[0170] As described above, the distances between the upper-level reference point B and the lower-level reference points 611 to 619 are calculated in advance. Therefore, the search unit 113 can determine the lower-level reference points 611, 613, 614, 615, 617, 618, and 619 within the search range 601 with minimal computation.
[0171] Next, the search unit 113 calculates azimuth information α representing the azimuth from reference point B to query Q. Within a specific azimuth range 602 centered on azimuth information α, the search unit 113 searches sequentially, starting from points close to azimuth information α. The search unit 113 obtains a lower-level reference point 611 whose azimuth information relative to reference point B is similar to azimuth information α. Specifically, the search unit 113, for example, obtains a lower-level reference point 611 whose azimuth information relative to reference point B has a small deviation (azimuth deviation) from azimuth information α and a small difference between its distance from reference point B and its distance Ln1. In other words, the search unit 113 obtains a lower-level reference point 611 with azimuth information and distance relative to reference point B that has a similarity to azimuth information α and distance Ln1 of a threshold or higher. For example, the Hamming distance between the two azimuth information values is used as the magnitude of the azimuth deviation. Furthermore, the search unit 113 sets the lower-level reference point 611 as the reference point of the temporary nearest neighbor cluster (temporary nearest neighbor reference point).
[0172] As described above, the azimuth information from the upper-level reference point B to the lower-level reference points 611 to 619 is calculated in advance. Therefore, the search unit 113 can determine the lower-level reference point 611 with a small deviation between its azimuth information and azimuth information α relative to the reference point B, and with a small difference between its distance from the reference point B and its distance Ln1, using less computation.
[0173] Furthermore, although the lower-level reference point 612 is within the range 602 of the azimuth information α, its distance from the reference point B exceeds the distance 2Ln1 (i.e., it is outside the range 601), so it is not set as the temporary nearest neighbor reference point.
[0174] Next, the search unit 113 calculates the distance Ln2 between the temporary nearest neighbor reference point 611 and the query Q. In this case, ideally, it is desirable to search for lower-level reference points (lower-level clusters) within a radius 603 centered on the query Q with a radius Ln2. In other words, it is desirable to exclude lower-level reference points located outside the radius 603 from the lower-level reference points being searched. However, the distances between the query Q and the lower-level reference points 612 to 619 are unknown before the calculation.
[0175] Therefore, the search unit 113 calculates a range 604 with a radius of 2Ln2 centered on the temporary nearest neighbor reference point 611. Lower-level reference points within the range 604 may be closer to the query Q than the temporary nearest neighbor reference point 611. Based on the pre-calculated distances between lower-level reference points, the search unit 113 can determine whether each lower-level reference point of the search target is within the range 604. Thus, the search unit 113 can exclude lower-level reference points (lower-level clusters) located outside the search range 604 from the lower-level reference points of the search target.
[0176] Furthermore, the search unit 113 determines the range 607 obtained by removing range 606 from range 605. Range 605 is a range centered on reference point B with a radius of (Ln1+Ln2), which is the distance obtained by adding distance Ln1 to distance Ln2. Range 606 is a range centered on reference point B with a radius of (Ln1-Ln2), which is the distance obtained by subtracting distance Ln2 from distance Ln1. Range 607 includes all lower-level reference points whose distance from query Q may be less than distance Ln2. The search unit 113 can determine whether each lower-level reference point is within range 607 based on the pre-calculated distance between reference point B and each lower-level reference point. Thus, the search unit 113 can exclude lower-level reference points outside range 607 from the lower-level reference points of the search target.
[0177] Furthermore, the search unit 113 determines the search range 608 where range 604 and range 607 overlap. Vectors within the search range 608 may be closer to query Q than the temporary nearest neighbor reference point 611. The search unit 113 can determine whether each lower-level reference point of the search object is within the search range 608 based on the pre-calculated distances between reference points, that is, based on the distances between reference point B and each of the lower-level reference points 611 to 619, and the distances between the temporary nearest neighbor reference point 611 and other lower-level reference points 612 to 619. Thus, the search unit 113 can exclude vectors outside the search range 608 from the vectors of the search object.
[0178] Additionally, the search unit 113 calculates azimuth information β representing the azimuth from the temporary nearest neighbor reference point 611 to the query Q. Within a specific azimuth range 609 centered on the azimuth information β and within the search range 608, the search unit 113 sequentially searches, starting from points close to the azimuth information β. The search unit 113 obtains lower-level reference points 613 within the search range 609 whose azimuth information relative to the temporary nearest neighbor reference point 611 is similar to the azimuth information β. Specifically, the search unit 113, for example, obtains lower-level reference points 613 within the search range 609 whose azimuth information relative to the temporary nearest neighbor reference point 611 has a small deviation from the azimuth information β (e.g., less than a threshold).
[0179] The azimuth information indicating the azimuth from the temporary nearest neighbor reference point 611 to the respective azimuths of the other lower-level reference points 612-619 is calculated in advance. Furthermore, as described above, the distances between reference point B and each of the lower-level reference points 611-619, as well as the distances between the temporary nearest neighbor reference point 611 and the other lower-level reference points 612-619, are calculated in advance. Therefore, the search unit 113 can determine the lower-level reference point 613 within the search range 608 whose azimuth information relative to the temporary nearest neighbor reference point 611 is similar to the azimuth information β, with minimal computation.
[0180] Then, the search unit 113 calculates the distance Ln3 between the lower layer reference point 613 and the query Q.
[0181] When the distance from Ln3 is greater than or equal to the distance from Ln2, the search unit 113 repeatedly searches for lower-level reference points within the search range 608 that have similar azimuth information to the azimuth information β relative to the temporary nearest neighbor reference point 611, for example, until there are no unsearched lower-level reference points within the search range 608 or until a lower-level reference point is obtained from the search range 608 that is less than the distance from Ln2 to the query Q.
[0182] On the other hand, if the distance to Ln3 is less than the distance to Ln2, the search unit 113 sets the lower-level reference point 613 as the new temporary nearest neighbor reference point. Then, the search unit 113 performs the same search on the new temporary nearest neighbor reference point 613 as it did on the temporary nearest neighbor reference point 611 described above.
[0183] For example, in the search for temporary nearest neighbor reference point 613, if no new temporary nearest neighbor reference point is set until there are no unsearched lower-level reference points, such as... Figure 7 As shown, the search unit 113 determines the temporary nearest neighbor reference point 613 as the nearest neighbor reference point 613. That is, the search unit 113 determines the lower-level cluster with the nearest neighbor reference point 613 as the approximate nearest neighbor cluster. When the determined approximate nearest neighbor cluster is the lowest-level cluster, this approximate nearest neighbor cluster is used as the object cluster for the approximate nearest neighbor vector search.
[0184] Through the above approximate nearest neighbor cluster search, the search unit 113 can efficiently search for approximate nearest neighbor clusters using the pre-calculated distances and orientations between reference points.
[0185] Figure 8 This is a graph representing an example of the probability of occurrence of a vector of a search object in an approximate nearest neighbor search system 1, corresponding to the Hamming distance representing the azimuth deviation of the query vector and the vector of the search object. Figure 8 In the diagram, the horizontal axis represents the Hamming distance, and the vertical axis represents the probability of occurrence. The vector of the search object can be either a reference point (reference vector) belonging to a lower-level cluster of a higher-level cluster, or a vector included in dataset 21 (e.g., a vector belonging to the lowest-level cluster).
[0186] The orientational deviation between the query vector and the vector of the search object is represented, for example, by the Hamming distance between the orientation information of the query vector and the orientation information of the vector of the search object. The orientation information of the query vector, for example, represents the orientation from the reference point to the query vector. The orientation information of the vector of the search object, for example, represents the orientation from the reference point to the vector of the search object.
[0187] Here, the orientation information of the vectors is assumed to be a orientation hash composed of 32-bit data strings. In this case, the Hamming distance between the orientation information of two vectors is represented by the number of different bits when comparing each bit sequentially between the two 32-bit data strings. Therefore, the Hamming distance between the orientation information of two vectors is any value from 0 to 32. The search unit 113 obtains the Hamming distance between the orientation information of two vectors, for example, by performing an XOR operation on the two 32-bit data strings and counting the number of bits with a value of 1.
[0188] For example, when the Hamming distance is 0, the orientation information of the two vectors is identical across all bits. Conversely, for example, when the Hamming distance is 32, the orientation information of the two vectors is different across all bits.
[0189] Therefore, the smaller the Hamming distance, the more similar the orientation information of the two vectors. On the other hand, the larger the Hamming distance, the more different the orientation information of the two vectors. In other words, the larger the Hamming distance, the closer the other vector is to the opposite vector of the first vector.
[0190] The probability of occurrence 65 of the vector of the search object, corresponding to the Hamming distance between the query vector and the vector of the search object, is maximized, for example, at the intermediate Hamming distance (here, 16). Furthermore, the probability of occurrence 65 of the vector of the search object decreases as the azimuth information that forms the intermediate Hamming distance approaches the azimuth information of the query vector (i.e., as the Hamming distance between azimuth information decreases from the intermediate Hamming distance). Additionally, the probability of occurrence 65 of the vector of the search object decreases as the azimuth information that forms the intermediate Hamming distance moves further away from the azimuth information of the query vector (i.e., as the Hamming distance between azimuth information increases from the intermediate Hamming distance).
[0191] Based on the probability of occurrence of such a vector of the search object being 65, for example, if a vector with a smaller Hamming distance to the azimuth information relative to the reference point and a smaller azimuth information relative to the reference point is set as a temporary nearest neighbor (e.g., Figure 7 If the temporary nearest neighbor reference point 611 is used, then the computational cost until the approximate nearest neighbor point is easily reduced. On the other hand, if the vector with a large Hamming distance from the reference point to the query vector and with orientation information relative to the reference point is set as the temporary nearest neighbor point, then the search for obtaining the approximate nearest neighbor point is close to an exhaustive search. Therefore, it can be said that the computational cost until the approximate nearest neighbor point is easily increased.
[0192] Therefore, the search unit 113 uses pre-calculated orientation information between vectors to designate vectors with orientation information relative to the reference point that is similar to the orientation information from the reference point to the query vector (i.e., with a small Hamming distance) as temporary nearest neighbors. Thus, the search unit 113 can efficiently perform the search for approximate nearest neighbors.
[0193] Figure 9 This diagram illustrates a first example of an approximate nearest neighbor vector search in the approximate nearest neighbor search system 1, using the distance and orientation between vectors. The search unit 113, for example, searches for an approximate nearest neighbor vector from N vectors belonging to an approximate nearest neighbor cluster. Here, the case of searching for an approximate nearest neighbor vector from an approximate nearest neighbor cluster having a reference point Bn is illustrated. Figure 9In the example shown, the nine vectors 711 to 719 belong to the approximately nearest neighbor cluster.
[0194] The distances between the reference point Bn and each of vectors 711 to 719 are calculated in advance. The orientation information representing the directions from the reference point Bn to each of vectors 711 to 719 is calculated in advance. However, it is assumed that the distances between vectors 711 to 719 and the orientation information representing the mutual directions between vectors 711 to 719 are not calculated in advance.
[0195] First, the search unit 113 calculates the distance Ln4 between the reference point Bn and the query Q. The search unit 113 can also set a search range 701 with a radius of 2Ln4 centered on the reference point Bn. Figure 9 In the example shown, the search range 701 contains seven vectors: 711, 713, 714, 715, 717, 718, and 719.
[0196] As described above, the distances between the reference point Bn and vectors 711 to 719 are calculated in advance. Therefore, the search unit 113 can determine vectors 711, 713, 714, 715, 717, 718, and 719 within the search range 701 with minimal computation.
[0197] Next, the search unit 113 calculates the azimuth information γ representing the direction from the reference point Bn to the query Q. Within a specific azimuth range 702 centered on the azimuth information γ, the search unit 113 searches sequentially, starting from locations close to the azimuth information γ. The search unit 113 obtains a vector 711 whose azimuth information relative to the reference point Bn is similar to the azimuth information γ. Specifically, the search unit 113, for example, obtains a vector 711 whose azimuth information relative to the reference point Bn has a small deviation (azimuth deviation) from the azimuth information γ and whose distance from the reference point Bn differs from the distance Ln4 small. In other words, the search unit 113 obtains a vector 711 whose azimuth information and distance relative to the reference point Bn have a similarity to the azimuth information γ and the distance Ln4 that is at least a threshold. Then, the search unit 113 sets vector 711 as a temporary nearest neighbor vector.
[0198] As described above, the orientation information of the reference point Bn and vectors 711 to 719 is calculated in advance. Therefore, the search unit 113 can determine vector 711 with a small deviation from the orientation information γ relative to the reference point Bn and a small difference between the distance from the reference point Bn and the distance Ln4 with minimal computation.
[0199] Furthermore, although vector 712 is within the range 702 of the orientation information γ, its distance from the reference point Bn exceeds the distance 2Ln4 (i.e., it is outside the range 701), therefore, it is not set as the temporary nearest neighbor vector.
[0200] Next, the search unit 113 calculates the distance Ln5 between the temporary nearest neighbor vector 711 and the query Q. The search unit 113 sets the distance Ln5 as the temporary nearest neighbor distance. In this case, ideally, it is desirable to search for vectors that are within a radius 703 centered on the query Q with a radius Ln5. In other words, it is desirable to exclude vectors outside the range 703 from the vectors of the search target. However, the distances between the query Q and each of the vectors 712 to 719 are unknown before the calculation.
[0201] Furthermore, a vector within a radius of 2Ln5 of 704 centered on the temporary nearest neighbor vector 711 may be closer to the query Q than the temporary nearest neighbor vector 711. However, the distances between the temporary nearest neighbor vector 711 and vectors 712–719 are also unknown before calculation.
[0202] Therefore, the search unit 113 determines a search range 707 obtained by removing range 706 from range 705. Range 705 is a range centered on the reference point Bn with a radius of (Ln4+Ln5), which is the distance obtained by adding distance Ln4 to distance Ln5. Range 706 is a range centered on the reference point Bn with a radius of (Ln4-Ln5), which is the distance obtained by subtracting distance Ln5 from distance Ln4. Search range 707 includes all vectors whose distance from query Q may be less than distance Ln5. The search unit 113 can determine whether each vector is within search range 707 based on the pre-calculated distance between the reference point Bn and each vector. Thus, the search unit 113 can exclude vectors outside search range 707 from the vectors of the search target.
[0203] Search unit 113 searches for vectors within search range 707 whose azimuth information relative to reference point Bn is similar to azimuth information γ. In this search, search unit 113 prioritizes vectors with azimuth information relative to reference point Bn that have a large azimuth deviation from the already searched vector (here, temporary nearest neighbor vector 711) and whose azimuth information relative to reference point Bn is similar. Figure 9 In the example shown, the search unit 113 obtains vector 713. Vector 713 is within the search range 707, and the orientation information from the reference point Bn to vector 713 is similar to the orientation information γ. Furthermore, the orientation deviation between the orientation information from the reference point Bn to vector 713 and the orientation information from the reference point Bn to the temporary nearest neighbor vector 711 is large (e.g., larger than the orientation deviation between the orientation information from the reference point Bn to vector 713 and the orientation information γ).
[0204] Search unit 113 calculates the distance Ln6 between vector 713 and query Q. Search unit 113 determines whether distance Ln6 is less than the temporary nearest neighbor distance Ln5. Since distance Ln6 is less than the temporary nearest neighbor distance Ln5, search unit 113 sets vector 713 as the new temporary nearest neighbor vector. Additionally, search unit 113 sets distance Ln6 as the new temporary nearest neighbor distance. Then, search unit 113 performs the same search on the new temporary nearest neighbor vector 713 as it did on the temporary nearest neighbor vector 711 described above.
[0205] In the search for the temporary nearest neighbor vector 713, if no new temporary nearest neighbor vector is set until there are no unsearched vectors, such as Figure 9 As shown, the search unit 113 determines the temporary nearest neighbor vector 713 as the nearest neighbor vector 713. Then, the search unit 113 outputs the nearest neighbor vector 713 as an approximate nearest neighbor vector, for example.
[0206] Based on the above approximate nearest neighbor vector search, the search unit 113 can efficiently search for approximate nearest neighbor vectors by using the pre-calculated distances between the reference point Bn and each of the vectors 711 to 719 and the directional information representing the directions from the reference point Bn to each of the vectors 711 to 719.
[0207] Furthermore, in the near nearest neighbor cluster, not only a reference point Bn can be set, but also one or more auxiliary reference points can be set.
[0208] Figure 10 This is a diagram illustrating the second example of an approximate nearest neighbor vector search in Approximate Nearest Neighbor Search System 1, which uses the distance and orientation between vectors. Here, the case of searching for approximate nearest neighbor vectors from an approximate nearest neighbor cluster having a base point Bn and two auxiliary base points Ba and Bb is illustrated. Let 10 vectors 810–819 belong to the approximate nearest neighbor cluster.
[0209] Auxiliary reference point Ba is, for example, set at an arbitrary position at a distance from reference point Bn equal to the average distance (mean distance) between reference point Bn and the respective distances of the 10 vectors 810-819. Auxiliary reference point Bb is, for example, set at a position with the largest azimuth deviation from the azimuth information from reference point Bn to all previously set auxiliary reference points, and at a distance equal to the average distance from reference point Bn. Figure 10 In the example shown, the auxiliary reference point Bb is set in a way that maximizes the azimuth deviation between the azimuth information from reference point Bn to auxiliary reference point Ba and the azimuth information from reference point Bn to auxiliary reference point Bb. Furthermore, this example illustrates setting two auxiliary reference points Ba and Bb, but it is also possible to set three or more auxiliary reference points.
[0210] The distances between reference point Bn and vectors 810-819 are calculated beforehand. The azimuth information representing the directions from reference point Bn to vectors 810-819 is calculated beforehand. The distances between auxiliary reference point Ba and vectors 810-819 are calculated beforehand. The azimuth information representing the directions from auxiliary reference point Ba to vectors 810-819 is calculated beforehand. The distances between auxiliary reference point Bb and vectors 810-819 are calculated beforehand. The azimuth information representing the directions from auxiliary reference point Bb to vectors 810-819 is calculated beforehand. Furthermore, it is assumed that the distances between vectors 810-819 and the azimuth information representing the mutual directions between vectors 810-819 are not calculated beforehand.
[0211] First, the search unit 113 calculates the distance Ln7 between the reference point Bn and the query Q. The search unit 113 can also set a search range 801 with a radius of 2Ln7 centered on the reference point Bn. Figure 10 In the example shown, the search range 801 contains eight vectors: 810, 812, 813, 814, 815, 817, 818, and 819.
[0212] As described above, the distances between the reference point Bn and vectors 810 to 819 are calculated in advance. Therefore, the search unit 113 can determine vectors 810, 812, 813, 814, 815, 817, 818, and 819 within the search range 801 with minimal computation.
[0213] Next, the search unit 113 calculates the orientation information αn representing the direction from the reference point Bn to the query Q. Within a specific orientation range 802 centered on the orientation information αn, the search unit 113 searches sequentially, starting from locations close to the orientation information αn. The search unit 113 obtains a vector 812 whose orientation information relative to the reference point Bn is similar to the orientation information αn. Specifically, the search unit 113, for example, obtains a vector 812 whose orientation information relative to the reference point Bn has a small deviation from the orientation information αn and whose distance from the reference point Bn differs from the distance Ln7. In other words, the search unit 113 obtains a vector 812 with orientation information and distance relative to the reference point Bn that has a similarity to the orientation information αn and the distance Ln7 of a threshold or higher. Then, the search unit 113 sets vector 812 as a temporary nearest neighbor vector.
[0214] As described above, the orientation information of the reference point Bn and vectors 810 to 819 is calculated in advance. Therefore, the search unit 113 can determine vector 812 with a small deviation between its orientation information and orientation information αn relative to the reference point Bn and a small difference between its distance from the reference point Bn and its distance Ln7 with minimal computation.
[0215] Furthermore, although vector 811 is within the range 802 of the orientation information αn, its distance from the reference point Bn exceeds the distance 2Ln7 (i.e., it is outside the range 801), therefore, it is not set as the temporary nearest neighbor vector.
[0216] Next, the search unit 113 calculates the distance Ln8 between the temporary nearest neighbor vector 812 and the query Q. The search unit 113 sets the distance Ln8 as the temporary nearest neighbor distance. In this case, ideally, it is desirable to search for vectors within a radius 803 centered on the query Q with a radius Ln8. In other words, it is desirable to exclude vectors outside the range 803 from the vectors of the search target. However, the distances between the query Q and vectors 810, 811, and 813-819 are unknown before the calculation.
[0217] Furthermore, a vector within a radius of 2Ln8 of the temporary nearest neighbor vector 812 may be closer to the query Q than the temporary nearest neighbor vector 812. However, the distances between the temporary nearest neighbor vector 812 and vectors 810, 811, and 813–819 are also unknown before calculation.
[0218] Therefore, the search unit 113 determines a search range 806 obtained by removing range 805 from range 804. Range 804 is a range centered on the reference point Bn with a radius of (Ln7+Ln8), which is the distance obtained by adding distance Ln7 to distance Ln8. Range 805 is a range centered on the reference point Bn with a radius of (Ln7-Ln8), which is the distance obtained by subtracting distance Ln8 from distance Ln7. Search range 806 includes all vectors whose distance from query Q may be less than distance Ln8. The search unit 113 can determine whether each vector is within search range 806 based on the pre-calculated distance between the reference point Bn and each vector. Thus, the search unit 113 can exclude vectors outside search range 806 from the vectors of the search target.
[0219] Next, the search unit 113 calculates azimuth information αa representing the direction from the auxiliary reference point Ba to the query Q. Additionally, the search unit 113 calculates azimuth information αb representing the direction from the auxiliary reference point Bb to the query Q.
[0220] For example, the search unit 113 calculates the sum of the azimuth deviations (e.g., Hamming distances) with the azimuth information αn, αa, and αb for each of the vectors 810, 812, 813, and 814 within the search range 806.
[0221] For example, let's specifically explain the case where the total azimuth deviations of vector 810 from the azimuth information αn, αa, and αb are calculated. As described above, the azimuth information from reference point Bn to vector 810, the azimuth information from auxiliary reference point Ba to vector 810, and the azimuth information from auxiliary reference point Bb to vector 810 are calculated in advance. In this case, the search unit 113 calculates the first Hamming distance between the azimuth information αn and the azimuth information from reference point Bn to vector 810. The search unit 113 calculates the second Hamming distance between the azimuth information αa and the azimuth information from auxiliary reference point Ba to vector 810. The search unit 113 calculates the third Hamming distance between the azimuth information αb and the azimuth information from auxiliary reference point Bb to vector 810. Then, the search unit 113 obtains the total azimuth deviations of vector 810 from the azimuth information αn, αa, and αb by calculating the sum of the first, second, and third Hamming distances.
[0222] Furthermore, the search unit 113 can also multiply the sum of the first Hamming distance, the second Hamming distance, and the third Hamming distance by a weight corresponding to the difference between the distance between vector 810 and the reference point Bn and the distance Ln7, to obtain the total azimuth deviation of vector 810 from the azimuth information αn, αa, and αb. For example, the larger the difference between the distance between vector 810 and the reference point Bn and the distance Ln7, the larger the weight used by the search unit 113; the smaller the difference, the smaller the weight used by the search unit 113. This is because the smaller the difference, the higher the probability of becoming the nearest neighbor vector even if there is an azimuth deviation.
[0223] The search unit 113 also obtains the sum of the azimuth deviations from the azimuth information αn, αa, and αb for each of the other vectors 812, 813, and 814.
[0224] The search unit 113 evaluates vectors based on the probability that the vector with the smaller the total of the obtained azimuth deviations is the nearest neighbor vector. For example, the search unit 113 selects S vectors whose total azimuth deviations are less than a fourth threshold as candidate vectors for nearest neighbors. Alternatively, the search unit 113 may select S vectors with even smaller total azimuth deviations as candidate vectors for nearest neighbors. S is, for example, an integer greater than or equal to 1. The search unit 113 calculates the distance between each of the S candidate vectors and the query Q. Then, the search unit 113 outputs, for example, the candidate vector with the smallest distance to the query Q as the approximate nearest neighbor vector.
[0225] exist Figure 10In this process, the search unit 113, for example, selects three vectors 812, 810, and 813 with smaller total azimuth deviations as candidate vectors for nearest neighbor vectors. The search unit 113 calculates the distance between each of the three candidate vectors 812, 810, and 813 and the query Q. Then, the search unit 113 outputs, for example, the candidate vector 812 with the smallest distance to the query Q as the approximate nearest neighbor vector.
[0226] Based on the above approximate nearest neighbor vector search, the search unit 113 can efficiently search for approximate nearest neighbor vectors using pre-calculated distances between reference point Bn and vectors 810-819, azimuth information representing the direction from reference point Bn to vectors 810-819, distances between auxiliary reference point Ba and vectors 810-819, azimuth information representing the direction from auxiliary reference point Ba to vectors 810-819, distances between auxiliary reference point Bb and vectors 810-819, and azimuth information representing the direction from auxiliary reference point Bb to vectors 810-819.
[0227] Furthermore, the search unit 113 may use a reference point and multiple auxiliary reference points to narrow the search range for the approximate nearest neighbor vector (or the search range for the approximate nearest neighbor cluster) before calculating the distance between the query and the vector.
[0228] Figure 11 This illustrates an example of an approximate nearest neighbor search system 1 that uses a reference point and multiple auxiliary reference points to narrow down the search range for the approximate nearest neighbor vector. The auxiliary reference points are preferably located at equally distributed positions within the cluster of the search object. Here, the case of searching for the approximate nearest neighbor vector from an approximate nearest neighbor cluster having a reference point B and two auxiliary reference points Bf and Bo is illustrated.
[0229] First, the search unit 113 calculates the distance Ln between the reference point B and the query Q. Ideally, in this case, it is desirable to search for vectors within a radius 901 centered on the query Q with respect to radius Ln. In other words, it is desirable to exclude vectors outside the range 901 from the search target vectors. However, the distance between the query Q and each vector is unknown before calculation. Therefore, in order to determine whether each vector is inside or outside the range 901, the distance between the query Q and each vector must be calculated, increasing the computational load.
[0230] Therefore, as Figure 11 As shown, the search unit 113 determines a range 902 with a radius of 2Ln centered on the reference point B. Vectors within the range 902 may be closer to the query Q than the reference point B.
[0231] Next, the search unit 113 calculates the distance Lf between the auxiliary reference point Bf and the query Q. The search unit 113 excludes the inner side 904A of the first range centered on the reference point Bf and with a radius of (Lf-Ln), which is the distance obtained by subtracting the distance Ln from the distance Lf, from the range 902. In addition, the search unit 113 excludes the outer side 904B of the second range centered on the auxiliary reference point Bf and with a radius of (Lf+Ln), which is the distance obtained by adding the distance Ln to the distance Lf, from the range 902.
[0232] Similarly, the search unit 113 calculates the distance Lo between the auxiliary reference point Bo and the query Q. The search unit 113 excludes the inner side 906A of the third range centered on the reference point Bo and with a radius of (Lo-Ln), which is the distance obtained by subtracting the distance Ln from the distance Lo, from the range 902. In addition, the search unit 113 excludes the outer side 906B of the fourth range centered on the auxiliary reference point Bo and with a radius of (Lo+Ln), which is the distance obtained by adding the distance Ln to the distance Lo, from the range 902.
[0233] Therefore, the search unit 113 uses the range 908 obtained by excluding the inner side 904A of the first range, the outer side 904B of the second range, the inner side 906A of the third range, and the outer side 906B of the fourth range from the range 902 as the search range for the approximate nearest neighbor vector. Thus, the search unit 113 is able to narrow down the search range for the approximate nearest neighbor vector using a reference point and multiple auxiliary reference points before calculating the distance between the query and the vector.
[0234] also, Figure 11 The method shown can also be applied to the case of searching for the nearest neighbor cluster from one or more subordinate clusters (more specifically, subordinate reference points) belonging to a superior cluster with a reference point B and multiple auxiliary reference points.
[0235] Next, refer to Figure 12 as well as Figure 13 The structure of the hybrid index information 22 used in the approximate nearest neighbor search system 1 will be described. The hybrid index information 22 includes upper-level index information 221 and lower-level index information 222.
[0236] Figure 12 This illustrates a structural example of the upper-level index information 221 used in the approximate nearest neighbor search system 1. The upper-level index information 221 includes multiple entries corresponding to multiple upper-level clusters. Each entry includes, for example, fields for cluster ID, reference position, lower-level cluster ID, distance information of the lower-level cluster, orientation information of the lower-level cluster, cluster ID of the same-level cluster, distance information of the same-level cluster, and orientation information of the same-level cluster.
[0237] In the entry corresponding to a certain higher-level cluster, the cluster ID field represents the identification information (cluster ID) assigned to that higher-level cluster. The cluster ID is information that can uniquely identify the corresponding cluster.
[0238] The reference position field represents the reference position (absolute position information) of the corresponding upper-level cluster. The reference position is, for example, equivalent to any vector that belongs directly or indirectly to the lowest-level cluster of this upper-level cluster.
[0239] The cluster ID field of a lower-level cluster represents a list of more than one cluster IDs assigned to one or more lower-level clusters belonging to the corresponding upper-level cluster. For example, the cluster ID field lists these more than one cluster IDs. Lower-level clusters belonging to the upper-level cluster are also referred to as their parent lower-level clusters.
[0240] The distance information field of a lower-level cluster represents the distance (distance information) between the corresponding upper-level cluster and one or more lower-level clusters belonging to that upper-level cluster. Specifically, the distance information field of a lower-level cluster represents the distance between the reference position of the upper-level cluster and the reference positions of one or more subordinate lower-level clusters. For example, the distance information field of a lower-level cluster may list one or more distances corresponding to one or more subordinate lower-level clusters.
[0241] The azimuth information field of a lower-level cluster represents the azimuth information from the corresponding upper-level cluster to the respective azimuths of one or more lower-level clusters belonging to that upper-level cluster. Specifically, the azimuth information field of a lower-level cluster represents the azimuth information from the reference position of the upper-level cluster to the reference positions of one or more of its respective lower-level clusters. For example, the azimuth information field of a lower-level cluster may list one or more azimuth information corresponding to one or more of its respective lower-level clusters.
[0242] The information set in the cluster ID field, the distance information field, and the orientation information field of the lower-level cluster is also referred to as lower-level information 221A.
[0243] The Cluster ID field of a same-level cluster represents a list of more than one cluster IDs assigned to one or more clusters located at the same level as the corresponding parent cluster (same-level cluster). For example, the Cluster ID field of a same-level cluster lists more than one cluster ID.
[0244] The distance information field for a cluster within the same layer indicates the distances (distance information) between the corresponding parent cluster and one or more other clusters within the same layer. Specifically, the distance information field for a cluster within the same layer indicates the distance between the reference position of the parent cluster and the reference positions of one or more other clusters within the same layer. For example, the distance information field for a cluster within the same layer may list one or more distances corresponding to each of the more than one clusters within the same layer.
[0245] The orientation information field for a co-cluster represents the orientation information from the corresponding parent cluster to the respective orientations of one or more co-clusters within that parent cluster. Specifically, the orientation information field for a co-cluster represents the orientation information from the reference position of the parent cluster to the respective reference positions of one or more co-clusters. For example, the orientation information field for a co-cluster may list one or more orientation information corresponding to one or more co-clusters.
[0246] The information set in the cluster ID field, the distance information field, and the orientation information field of the same cluster are also referred to as same-layer information 221B.
[0247] exist Figure 12 In the example shown, for instance, the entry corresponding to the top-level cluster assigned cluster ID "Z000" includes the reference position "BZ000", the cluster IDs of the lower-level clusters "Y000, Y001, ...", the distance information of the lower-level clusters "d-z00, d-z01, ...", and the orientation information of the lower-level clusters "a-z00, a-z01, ...". Furthermore, since the top-level cluster has no sibling clusters, the entry corresponding to the top-level cluster does not include the cluster IDs, distance information, or orientation information of the sibling clusters.
[0248] Additionally, for example, the entry corresponding to the upper-level cluster assigned cluster ID "Y001" includes the following information: reference position "BY000", cluster IDs of the lower-level clusters "X000, X001, ...", distance information of the lower-level clusters "d-y00, d-y01, ...", orientation information of the lower-level clusters "a-y00, a-y01, ...", cluster IDs of the same-level clusters "Y001, Y002, ...", distance information of the same-level clusters "d-Y01, d-Y02, ...", and orientation information of the same-level clusters "a-Y01, a-Y02, ...".
[0249] Based on the above configuration, the search unit 113 can perform an approximate nearest neighbor cluster search using the upper-level index information 221. Furthermore, the distance information and orientation information of the lower-level clusters correspond to the first relative position information described above. The distance information and orientation information of clusters within the same level correspond to the second relative position information described above.
[0250] Figure 13This illustrates a structural example of the lowest-level index information 222 used in the approximate nearest neighbor search system 1. The lowest-level index information 222 includes multiple entries corresponding to multiple lowest-level clusters. Each entry includes, for example, fields for cluster ID, reference position, auxiliary reference position, vector ID, distance information between the reference position and the vector, orientation information from the reference position to the vector, distance information between vectors, orientation information between vectors, distance information between the auxiliary reference position and the vector, and orientation information from the auxiliary reference position to the vector.
[0251] In the entry corresponding to a certain lowest-level cluster, the cluster ID field represents the identification information (cluster ID) assigned to that lowest-level cluster.
[0252] The reference position field represents the reference position (absolute position information) of the corresponding lowest-level cluster. For example, any D-dimensional vector belonging to the lowest-level cluster can also be used as the reference position.
[0253] The Auxiliary Reference Position field indicates one or more auxiliary reference positions set at the corresponding lowest-level cluster. Each of these auxiliary reference positions can, for example, be any D-dimensional vector belonging to that lowest-level cluster. The Auxiliary Reference Position field, for example, lists these one or more auxiliary reference positions.
[0254] The Vector ID field represents the N identification information (vector IDs) assigned to each of the N D-dimensional vectors (belonging vectors) belonging to the corresponding lowest-level cluster. The vector ID is information that uniquely identifies the corresponding vector. For example, the Vector ID field lists these N vector IDs.
[0255] The distance information field between the reference position and the vector represents the distance (distance information) between the corresponding lowest-level cluster and its N associated vectors. Specifically, the distance information field between the reference position and the vector represents the distance between the reference position (reference vector) of the lowest-level cluster and its N associated vectors. For example, the distance information field between the reference position and the vector lists the N distances corresponding to the N associated vectors.
[0256] The orientation information field from the reference position to the vector represents the orientation information from the corresponding lowest-level cluster to the orientation of each of the N associated vectors. Specifically, the orientation information field from the reference position to the vector represents the orientation information from the reference position (reference vector) of the lowest-level cluster to the orientation of each of the N associated vectors. For example, this field lists the N orientation information corresponding to each of the N associated vectors.
[0257] The distance information field between vectors represents the distances (distance information) between vectors belonging to the corresponding lowest-level cluster. Specifically, the distance information field between vectors, for example, represents the distances between each of the N belonging vectors and each of the other (N-1) belonging vectors. For example, the distance information field between vectors may list the distances between N×(N-1) vectors.
[0258] The orientation information field between vectors represents the orientation information between vectors belonging to the corresponding lowest-level cluster. Specifically, the orientation information field between vectors represents, for example, the orientation information from each of the N belonging vectors to the other (N-1) belonging vectors. For example, the orientation information field between vectors may list the orientation information between N×(N-1) vectors.
[0259] The distance information field between auxiliary reference positions and vectors represents the distances (distance information) between each of the more than one auxiliary reference positions of the corresponding lowest-level cluster and each of the N associated vectors. For example, the distance information field between auxiliary reference positions and vectors lists the distances corresponding to each combination of more than one auxiliary reference position and each of the N associated vectors.
[0260] The orientation information field from auxiliary reference positions to vectors represents the orientation information from one or more auxiliary reference positions of the corresponding lowest-level cluster to the orientation of each of the N associated vectors. For example, this field lists the orientation information corresponding to combinations of one or more auxiliary reference positions and N associated vectors.
[0261] exist Figure 13 In the example shown, for instance, the entry corresponding to the lowest-level cluster assigned cluster ID "0000" includes the following settings: reference position "B0000", auxiliary reference positions "B0000-1, B0000-2, ...", vector IDs "va00, vb00, vc00, ...", distance information between the reference position and the vector "D-a00, D-b00, ...", orientation information from the reference position to the vector "A-a00, A-b00, ...", and distance information between vectors "d-ab00, d-ac00, ... ..., d-ba00, d-bc00, ...”, the orientation information between vectors “a-ab00, a-ac00, ..., a-ba00, a-bc00, ...”, the distance information between the auxiliary reference position and the vectors “D-a100, D-b100, ..., D-a200, D-b200, ...”, and the orientation information from the auxiliary reference position to the vectors “A-a100, A-b100, ..., A-a200, A-b200, ...”.
[0262] Based on the above configuration, the search unit 113 can perform an approximate nearest neighbor vector search using the lowest-level index information 222. Furthermore, in the lowest-level index information 222, each entry may only include orientation information from the auxiliary reference position to the vector, excluding distance information between the auxiliary reference position and the vector. Additionally, each entry may exclude both orientation information and distance information between vectors, or it may include either one. Alternatively, some entries may include at least one of orientation information and distance information between vectors.
[0263] Reference Figures 14-19 The processing performed in the approximate nearest neighbor search system 1 is described.
[0264] (Build Processing)
[0265] Figure 14 This is a flowchart illustrating an example of a build process executed by processor 11. The build process is the process of using dataset 21 to build a hybrid index structure 22 that includes hierarchical clusters (HC) and intra-cluster positional relationships. More specifically, the build process is the process of using dataset 21 to generate hybrid index information 22. Processor 11 executes the build process, for example, based on the fact that dataset 21 is stored in secondary storage device 14.
[0266] First, processor 11 constructs a hierarchical cluster HC using dataset 21 (step S101). Specifically, processor 11 determines the lowest-level cluster to which each of the multiple vectors included in dataset 21 belongs, for example, so that more than one vector that is closer belongs to the same lowest-level cluster. In addition, processor 11 determines the hierarchical structure of the clusters, for example, in a manner that more than one cluster that is closer in reference position belongs to the same upper-level cluster.
[0267] Based on the constructed hierarchical cluster HC, processor 11 generates upper-level index information 221 corresponding to multiple upper-level clusters, and stores the information in secondary storage device 14 (step S102). Then, based on the constructed hierarchical cluster HC, processor 11 generates lower-level index information 222 corresponding to multiple lower-level clusters, stores the information in secondary storage device 14 (step S103), and ends the construction process.
[0268] Based on the above construction process, processor 11 can use dataset 21 to construct a hybrid index structure 22 that includes hierarchical clusters HC and intra-cluster positional relationships. Furthermore, processor 11 can generate upper-level index information 221 and lower-level index information 222 based on the constructed hybrid index structure 22.
[0269] (First relative position information generation and processing)
[0270] The upper-level index information 221 includes, for example,: (1) the relative position information of the reference point of the upper-level cluster and the reference points of each cluster (clusters at the same level) at the same level as the upper-level cluster; and (2) the relative position information of the reference point of the upper-level cluster and the reference points of each lower-level cluster belonging to the upper-level cluster. The relative position information includes, for example, azimuth information and distance information. For the generation of the relative position information in the upper-level index information 221, refer to... Figure 15 To explain in more detail.
[0271] Figure 15 This is a flowchart illustrating an example of the process of generating the first relative position information by processor 11. The first relative position information generation process is the process of generating the relative position information included in the upper-level index information 221. Here, the case of generating the relative position information included in the upper-level index information 221 corresponding to one upper-level cluster is illustrated. Figure 15 In this context, the parent-child cluster of the object whose relative position information is to be generated is called the object cluster.
[0272] First, the processor 11 obtains the reference vector of the object cluster (hereinafter referred to as the object reference vector) (step S201). The processor 11 selects a cluster at the same level as the object cluster from one or more clusters at the same level (hereinafter referred to as the object cluster at the same level) (step S202). The processor 11 obtains the reference vector of the object cluster at the same level (hereinafter referred to as the cluster at the same level) (step S203).
[0273] Next, the processor 11 calculates the distance between the object reference vector and the reference vector at the same level, and saves it as the distance information of the object's same-level cluster relative to the object cluster (step S204). Specifically, the processor 11 calculates, for example, the difference vector obtained by subtracting the object reference vector from the reference vector at the same level. The processor obtains the magnitude of the calculated difference vector as the distance between the object reference vector and the reference vector at the same level. Then, the processor 11 sets the distance information of the object's same-level cluster representing the obtained distance in the entry of the upper-level index information 221 corresponding to the object cluster.
[0274] Furthermore, the processor 11 calculates orientation information representing the orientation from the object reference vector to the same-layer reference vector, and stores it as the orientation information of the same-layer cluster of the object relative to the object cluster (step S205). Specifically, the processor 11 obtains R partial vectors, for example, based on the difference vector obtained by subtracting the object reference vector from the same-layer reference vector. The processor 11 uses the R partial vectors to calculate an R-bit orientation hash. Then, the processor 11 sets the orientation information of the same-layer cluster of the object representing the obtained orientation hash in the entry of the upper-level index information 221 corresponding to the object cluster.
[0275] Then, the processor 11 determines whether there are any unprocessed same-layer clusters in one or more same-layer clusters (step S206).
[0276] If there are unprocessed same-layer clusters (Yes in step S206), processor 11 returns to step S202. That is, further processing is performed to generate relative position information of the unprocessed same-layer clusters relative to the object cluster.
[0277] If there are no unprocessed same-layer clusters (No in step S206), the processor 11 selects a lower-layer cluster (hereinafter referred to as the object lower-layer cluster) from one or more lower-layer clusters belonging to the object cluster (step S207). The processor 11 obtains the reference vector of the object lower-layer cluster (hereinafter referred to as the lower-layer reference vector) (step S208).
[0278] Next, processor 11 calculates the distance between the object reference vector and the lower-level reference vector, and saves it as the distance information of the lower-level cluster of the object relative to the object cluster (step S209). Specifically, processor 11 calculates, for example, the difference vector obtained by subtracting the object reference vector from the lower-level reference vector. Processor 11 obtains the magnitude of the calculated difference vector as the distance between the object reference vector and the lower-level reference vector. Then, processor 11 sets the distance information of the lower-level cluster of the object representing the obtained distance in the entry of the upper-level index information 221 corresponding to the object cluster.
[0279] Furthermore, the processor 11 calculates orientation information representing the orientation from the object reference vector to the lower-level reference vector, and stores it as orientation information of the object lower-level cluster relative to the object cluster (step S210). Specifically, the processor 11 obtains R partial vectors, for example, based on the difference vector obtained by subtracting the object reference vector from the lower-level reference vector. The processor 11 uses the R partial vectors to calculate an R-bit orientation hash. Then, the processor 11 sets the orientation information of the object lower-level cluster representing the obtained orientation hash in the entry of the upper-level index information 221 corresponding to the object cluster.
[0280] Then, the processor 11 determines whether there are any unprocessed lower-level clusters in one or more lower-level clusters (step S211).
[0281] If there are unprocessed lower-level clusters (Yes in step S211), the processor 11 returns to step S207. That is, further processing is performed to generate relative position information of the unprocessed lower-level clusters relative to the object cluster.
[0282] If there are no unprocessed lower-level clusters (No in step S211), the processor 11 ends the first relative position information generation process.
[0283] Based on the first relative position information generation process described above, processor 11 can generate the relative position information included in the upper-level index information 221. Furthermore, the processing in steps S202 to S206 and the processing in steps S207 to S211 can either have their execution order reversed or be executed in parallel.
[0284] (Second relative position information generation and processing)
[0285] The lowest-level index information 222 includes, for example,: (1) the relative position information between the reference point of the lowest-level cluster and each vector belonging to the lowest-level cluster; (2) the relative position information between the auxiliary reference point of the lowest-level cluster and each vector belonging to the lowest-level cluster; and (3) the relative position information between vectors belonging to the lowest-level cluster. Regarding the generation of the relative position information in the lowest-level index information 222, refer to... Figure 16 To explain in more detail.
[0286] Figure 16 This is a flowchart illustrating an example of the process of generating the second relative position information by processor 11. The second relative position information generation process is the process of generating the relative position information included in the lowest-level index information 222. Here, the case of generating the relative position information included in the lowest-level index information 222 corresponding to a lowest-level cluster is illustrated. Figure 16 In this context, the lowest-level cluster of objects from which relative position information is to be generated is called the object cluster.
[0287] First, the processor 11 obtains the base vector of the object cluster (step S301). The processor 11 then obtains the auxiliary base vector of the object cluster (step S302). Multiple auxiliary base vectors may be obtained.
[0288] Processor 11 sets variable i to 1 (step S303). Variable i is used to determine the i-th vector (the i-th vector) among the N vectors belonging to the object cluster. Processor 11 obtains the i-th vector belonging to the object cluster (step S304).
[0289] Processor 11 calculates the distance between the reference vector and the i-th vector and stores it as the distance information of the i-th vector relative to the reference vector (step S305). Specifically, processor 11 calculates, for example, the difference vector obtained by subtracting the reference vector from the i-th vector. Processor 11 obtains the magnitude of the calculated difference vector as the distance between the i-th vector and the reference vector. Then, processor 11 sets the distance information of the i-th vector relative to the reference vector, representing the obtained distance, in the entry of the lowest-level index information 222 corresponding to the object cluster.
[0290] Furthermore, the processor 11 calculates an orientation hash representing the orientation from the reference vector to the i-th vector, and stores it as the orientation information of the i-th vector relative to the reference vector (step S306). Specifically, the processor 11 obtains R partial vectors, for example, based on the difference vector obtained by subtracting the reference vector from the i-th vector. The processor 11 uses the R partial vectors to calculate an R-bit orientation hash. Then, the processor 11 sets the orientation information of the i-th vector relative to the reference vector, representing the obtained orientation hash, in the entry of the lowest-level index information 222 corresponding to the object cluster.
[0291] The processor 11 calculates the distance between the auxiliary reference vector and the i-th vector, and saves it as the distance information of the i-th vector relative to the auxiliary reference vector (step S307). The specific method for calculating and saving the distance between the auxiliary reference vector and the i-th vector is to replace the reference vector in step S305 with the auxiliary reference vector.
[0292] The processor 11 calculates a position hash representing the orientation from the auxiliary reference vector to the i-th vector, and saves it as the orientation information of the i-th vector relative to the auxiliary reference vector (step S308). The specific method for calculating and saving the position hash from the auxiliary reference vector to the i-th vector is to replace the reference vector in step S306 with the auxiliary reference vector.
[0293] Furthermore, when there are multiple auxiliary reference vectors, each auxiliary reference vector is processed using steps S307 and S308.
[0294] Next, processor 11 sets variable j to 1 (step S309). Variable j is used to determine the j-th vector (the j-th vector) among the N vectors belonging to the object cluster. Processor 11 determines whether variable i and variable j are equal (step S310).
[0295] If variable i is equal to variable j ("Yes" in step S310), processor 11 proceeds to step S314.
[0296] If variable i and variable j are different (No in step S310), processor 11 obtains the j-th vector belonging to the object cluster (step S311). Processor 11 calculates the distance between the i-th vector and the j-th vector and saves it as the distance information of the j-th vector relative to the i-th vector (step S312). The specific method for calculating and saving the distance between the i-th vector and the j-th vector is to replace the reference vector in step S305 with the i-th vector and then replace the i-th vector with the j-th vector. Processor 11 calculates the azimuth hash representing the orientation from the i-th vector to the j-th vector and saves it as the orientation information of the j-th vector relative to the i-th vector (step S313), and proceeds to step S314. The specific method for calculating and saving the orientation from the i-th vector to the j-th vector is to replace the reference vector in step S306 with the i-th vector and then replace the i-th vector with the j-th vector.
[0297] Next, processor 11 increments variable j by 1 (step S314). Processor 11 determines whether variable j is the number of vectors N (hereinafter referred to as vector number N) belonging to the object cluster (step S315).
[0298] If the number of vectors j is less than or equal to the number of vectors N ("Yes" in step S315), the processor 11 returns to step S310. That is, the processor 11 further processes the acquisition of the relative position information (i.e., distance information and orientation information) of the new j-th vector relative to the i-th vector.
[0299] If variable j exceeds the number of vectors N (No in step S315), processor 11 increments variable i by 1 (step S316). Processor 11 then determines whether variable i is less than or equal to the number of vectors N (step S317).
[0300] If the number of vectors i is less than or equal to N ("Yes" in step S317), the processor 11 returns to step S304. That is, the processor 11 further processes the new i-th vector to obtain the relative position information of the reference vector, the auxiliary reference vector, and the j-th vector.
[0301] If variable i exceeds the number of vectors N (No in step S317), processor 11 ends the second relative position information generation process.
[0302] Based on the second relative position information generation process described above, processor 11 can generate the relative position information included in the lowest level index information 222.
[0303] (Approximate nearest neighbor cluster search processing)
[0304] Figure 17This is a flowchart illustrating an example of the approximate nearest neighbor cluster search process performed by processor 11. The approximate nearest neighbor cluster search process determines the approximate nearest neighbor cluster that serves as the starting point for the approximate nearest neighbor vector search process. For example, processor 11 performs the approximate nearest neighbor cluster search process based on receiving a query-based query vector (query) from external device 2. Here, the case where the search object for determining the approximate nearest neighbor cluster is a hierarchical cluster HC is illustrated.
[0305] First, the processor 11 sets the top-level cluster of the hierarchical cluster HC as the object cluster (step S401). The processor 11 obtains the upper-level index information 221 of the object cluster (step S402). The upper-level index information 221 of the object cluster is read from the secondary storage device 14 into the main memory 12, for example.
[0306] Processor 11 uses the acquired upper-level index information 221 to perform nearest-neighbor lower-level cluster search processing (step S403). Nearest-neighbor lower-level cluster search processing is the process of determining the closest lower-level cluster (hereinafter referred to as the nearest-neighbor lower-level cluster) among one or more lower-level clusters belonging to the object cluster. An example of the specific steps of the nearest-neighbor lower-level cluster search processing will be provided in [reference]. Figure 18 The flowchart is described later.
[0307] Next, the processor 11 determines whether the determined nearest neighbor lower-level cluster is the lowest-level cluster (step S404).
[0308] If the determined nearest neighbor sub-cluster cluster is not the lowest sub-cluster cluster (No in step S404), the processor 11 sets the nearest neighbor sub-cluster cluster as the new object cluster (step S405) and returns to step S402. That is, further processing is performed to determine the nearest neighbor sub-cluster cluster from one or more sub-clusters belonging to the new object cluster.
[0309] If the determined nearest neighbor sub-layer cluster is the lowest-level cluster ("Yes" in step S404), the processor 11 sets the nearest neighbor sub-layer cluster as the approximate nearest neighbor cluster (step S406) and ends the approximate nearest neighbor cluster search process.
[0310] Based on the above approximate nearest neighbor cluster search process, processor 11 can determine the queried approximate nearest neighbor cluster in the hierarchical cluster HC. The approximate nearest neighbor cluster is used as the starting point for the approximate nearest neighbor vector search process.
[0311] (Nearest neighbor lower-level cluster search processing)
[0312] Figure 18This is a flowchart illustrating an example of the nearest neighbor sub-cluster search process performed by processor 11. The nearest neighbor sub-cluster search process determines the closest sub-cluster (nearest neighbor sub-cluster) among one or more sub-clusters belonging to the object cluster. The nearest neighbor sub-cluster search process is equivalent to the process described above. Figure 17 Step S403.
[0313] First, processor 11 calculates the distance A between the reference vector of the object cluster and the query (step S501). Processor 11 then calculates the orientation information A representing the orientation from the reference vector of the object cluster to the query (step S502).
[0314] Processor 11 uses the upper-level index information 221 of the object cluster to determine, among one or more lower-level clusters belonging to the object cluster, a lower-level cluster with a distance B and orientation information B similar to distance A and orientation information A as a temporary nearest neighbor cluster (step S503). The upper-level index information 221 of the object cluster includes the relative position information (i.e., distance and orientation information) of each lower-level cluster relative to the reference vector of the object cluster. Processor 11 uses the relative position information of each lower-level cluster to determine, from one or more lower-level clusters belonging to the object cluster, a lower-level cluster (temporary nearest neighbor cluster) with a distance B and orientation information B similar to distance A and orientation information A. Distance A and orientation information A are similar to distance B and orientation information B, for example, the difference between distance A and distance B is less than a threshold A and the Hamming distance between orientation information A and orientation information B is less than a threshold B.
[0315] Processor 11 calculates the distance between the reference vector of the temporary nearest neighbor cluster and the query (step S504). The reference vector of the temporary nearest neighbor cluster is also called the temporary nearest neighbor point. The distance between the temporary nearest neighbor point and the query is also called the temporary nearest neighbor distance A. Processor 11 calculates the orientation information C representing the orientation from the temporary nearest neighbor point to the query (step S505).
[0316] Next, the processor 11 sets the range of the nearest neighbor cluster as the search range of the range where the distance A ± the temporary nearest neighbor distance A centered on the reference vector of the object cluster overlaps with the range of the temporary nearest neighbor point centered on 2 × the temporary nearest neighbor distance A (step S506). The processor 11 determines whether the lower-level clusters belonging to the object cluster include one or more unevaluated lower-level clusters that each satisfy the first condition, which is that the reference vector is within the search range and the orientation information representing the orientation relative to the temporary nearest neighbor point is similar to the orientation information C (step S507). In addition, the similarity of two orientation information is, for example, equivalent to the Hamming distance of these orientation information being less than the threshold C. Furthermore, unevaluated clusters are those that have not yet been evaluated for whether the distance to the query is less than the temporary nearest neighbor distance A.
[0317] If the lower-level clusters belonging to the object cluster do not include unevaluated lower-level clusters that meet the first condition (No in step S507), the processor 11 determines the temporary nearest neighbor cluster as the nearest neighbor lower-level cluster (step S508) and ends the nearest neighbor lower-level cluster search process.
[0318] If the lower-level clusters belonging to the object cluster include one or more unevaluated lower-level clusters that each satisfy the first condition ("Yes" in step S507), the processor 11 selects an unevaluated lower-level cluster as a candidate cluster from these one or more lower-level clusters (step S509). The processor 11 calculates the distance between the reference vector of the candidate cluster and the query (hereinafter referred to as the candidate distance A) (step S510). The processor 11 determines whether the candidate distance A is less than the temporary nearest neighbor distance A (step S511).
[0319] If the candidate distance A is less than the temporary nearest neighbor distance A ("Yes" in step S511), the processor 11 sets the candidate cluster as the temporary nearest neighbor cluster (step S512). Then, the processor 11 sets the candidate distance A as the temporary nearest neighbor distance A (step S513) and returns to step S505. That is, based on the new temporary nearest neighbor cluster and the temporary nearest neighbor distance A, further processing for searching for the nearest lower-level cluster is performed.
[0320] If the candidate distance A is greater than or equal to the temporary nearest neighbor distance A (No in step S511), the processor 11 determines whether one or more lower-level clusters that satisfy the first condition include unevaluated lower-level clusters (step S514).
[0321] If one or more lower-level clusters that satisfy the first condition include an unevaluated lower-level cluster ("Yes" in step S514), the processor 11 returns to step S509. That is, the unevaluated lower-level cluster is used to further perform processing for searching for a temporary nearest neighbor cluster.
[0322] If one or more lower-level clusters that satisfy the first condition do not include unevaluated lower-level clusters (No in step S514), the processor 11 determines the temporary nearest neighbor cluster as the nearest neighbor lower-level cluster (step S508) and ends the nearest neighbor lower-level cluster search process.
[0323] Based on the above nearest neighbor sub-cluster search process, the processor 11 can determine the nearest neighbor sub-cluster closest to the query from one or more sub-clusters belonging to the object cluster.
[0324] (Approximate nearest neighbor vector search processing)
[0325] Figure 19This is a flowchart illustrating an example of an approximate nearest neighbor vector search process performed by processor 11. The approximate nearest neighbor vector search process is the process of determining the approximate nearest neighbor vector for a query. Processor 11 performs the approximate nearest neighbor vector search process, for example, based on the determination of an approximate nearest neighbor cluster. Here, for example, let's assume it's performed via the previously referenced... Figure 17 The approximate nearest neighbor cluster search process determines the approximate nearest neighbor cluster. In this case, the processor 11 uses the approximate nearest neighbor cluster as a starting point and performs the approximate nearest neighbor vector search process.
[0326] First, processor 11 obtains the distance D between the reference vector of the approximate nearest neighbor cluster and the query (step S601). Processor 11 obtains the orientation information D representing the orientation from the reference vector to the query (step S602). In addition, the values calculated in the nearest neighbor lower-level cluster search process (i.e., the temporary nearest neighbor distance A and orientation information C at the time when the approximate nearest neighbor cluster search process is completed) can also be used as the distance D and the orientation information D.
[0327] Processor 11 selects a vector from the N vectors belonging to the approximate nearest neighbor cluster that has a distance E and orientation information E similar to the distance D and orientation information D, as a temporary nearest neighbor vector (step S603). Processor 11 calculates the distance between the temporary nearest neighbor vector and the query as the temporary nearest neighbor distance B (step S604). Processor 11 calculates the orientation information F representing the orientation from the temporary nearest neighbor vector to the query (step S605).
[0328] Next, processor 11 sets the range overlapping the distance D ± temporary nearest neighbor distance B centered on the reference vector with the range 2 × temporary nearest neighbor distance B centered on the temporary nearest neighbor vector as the search range for the nearest neighbor vector (step S606). Processor 11 determines whether the vectors belonging to the approximate nearest neighbor cluster include more than one unevaluated vector within the search range (step S607). Unevaluated vectors are those that have not yet been evaluated to determine whether their distance to the query is less than the temporary nearest neighbor distance B.
[0329] If the vectors belonging to the approximate nearest neighbor cluster do not include unevaluated vectors within the search range (No in step S607), the processor 11 outputs the temporary nearest neighbor vector as the approximate nearest neighbor vector (step S608) and ends the approximate nearest neighbor vector search process.
[0330] If the vectors belonging to the approximate nearest neighbor cluster include more than one unevaluated vector within the search range ("Yes" in step S607), the processor 11 selects the unevaluated vector as a candidate vector from among the more than one vector (step S609). Specifically, the processor 11 obtains, for example, pre-calculated azimuth information for each of the reference vector and one or more vectors. Using the obtained azimuth information, the processor 11 preferentially selects, for example, vectors with small azimuth deviations (e.g., Hamming distances) from azimuth information D and large azimuth deviations from the azimuth information from the reference vector to the searched (evaluated) vectors as candidate vectors. The processor 11 calculates the distance between the candidate vector and the query (hereinafter referred to as candidate distance B) (step S610). The processor 11 determines whether candidate distance B is less than the temporary nearest neighbor distance B (step S611).
[0331] If the candidate distance B is less than the temporary nearest neighbor distance B ("Yes" in step S611), the processor 11 sets the candidate vector as the temporary nearest neighbor vector (step S612). Then, the processor 11 sets the candidate distance B as the temporary nearest neighbor distance B (step S613) and returns to step S605. That is, based on the new temporary nearest neighbor vector and the temporary nearest neighbor distance B, further processing for searching for an approximate nearest neighbor vector is performed.
[0332] If the candidate distance B is greater than or equal to the temporary nearest neighbor distance B (No in step S611), the processor 11 determines whether one or more vectors within the search range include unevaluated vectors (step S614).
[0333] If more than one vector within the search range includes an unevaluated vector ("Yes" in step S614), the processor 11 returns to step S609. That is, the unevaluated vector is used for further processing to search for a temporary nearest neighbor vector.
[0334] If one or more vectors within the search range do not include unevaluated vectors (No in step S614), the processor 11 outputs the temporary nearest neighbor vector as the approximate nearest neighbor vector (step S608) and ends the approximate nearest neighbor vector search process.
[0335] Based on the above approximate nearest neighbor vector search process, the processor 11 can determine the approximate nearest neighbor vector to be queried from the N vectors belonging to the object cluster (approximate nearest neighbor cluster).
[0336] As explained above, this embodiment enables more efficient approximate nearest neighbor search for vector databases.
[0337] The approximate nearest neighbor search system 1 performs an approximate nearest neighbor search on a vector database (e.g., dataset 21) storing N D-dimensional vectors. The clustered index creation unit 111 manages N first-order location information pieces (e.g., lowest-level index information 222) pre-obtained through prior calculation, each of the N first-order location information pieces representing the location from a D-dimensional first reference vector to each of the N D-dimensional vectors. The search unit 113 receives a D-dimensional query vector. The search unit 113 calculates second-order location information representing the location from the first reference vector to the query vector. Using the N first-order location information pieces and the second-order location information, the search unit 113 searches for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors.
[0338] By using N first and second orientation information points, the search unit 113, for example, eliminates D-dimensional vectors from the N D-dimensional vectors that have orientation information dissimilar to the second orientation information, thereby obtaining one or more D-dimensional vectors. Furthermore, the search unit 113 searches for the approximate nearest neighbor vector of the query vector from the obtained one or more D-dimensional vectors. In this way, the search unit 113 can filter the D-dimensional vectors of the search object using orientation information.
[0339] Therefore, in the approximate nearest neighbor search system 1, the approximate nearest neighbor search for vector databases can be made more efficient.
[0340] The various functions described in this embodiment can each be implemented by a circuit (processing circuit). Examples of processing circuits include a programmed processor, such as a central processing unit (CPU). This processor executes the described functions by executing a computer program (command set) stored in memory. The processor can be a microprocessor that includes electrical circuitry. Examples of processing circuits also include digital signal processors (DSPs), application-specific integrated circuits (ASICs), microcontrollers, controllers, and other electrical circuit components. Other components besides the CPU described in this embodiment can also be implemented by processing circuits.
[0341] Several embodiments of the present invention have been described, but these embodiments are provided as examples and are not intended to limit the scope of the invention. These novel embodiments can be implemented in a wide variety of other ways, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their variations are included within the scope and spirit of the invention, as well as within the scope of the invention as described in the claims and its equivalents.
Claims
1. An approximate nearest neighbor search method, for a vector database storing N D-dimensional vectors, comprising: Manage N first-order location information pieces obtained in advance, each of the N first-order location information pieces representing the location from the first-order reference vector in D dimensions to the respective location of the N D-dimensional vectors; Receives a D-dimensional query vector; Calculate the second azimuth information representing the azimuth from the first reference vector to the query vector; and Using the N first-order location information and the second-order location information, search for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors. N is an integer greater than or equal to 2. D is an integer greater than or equal to 2.
2. The approximate nearest neighbor search method according to claim 1 further includes: Manage N first distance information pieces obtained in advance, each of the N first distance information pieces representing the first distance between the first reference vector and the N D-dimensional vectors respectively; Calculate the second distance information representing the second distance between the first reference vector and the query vector; and Using the N first-order location information, the N first-order distance information, the second-order location information, and the second-order distance information, search for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors.
3. The approximate nearest neighbor search method according to claim 2, Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors includes: Search among the N D-dimensional vectors for the first D-dimensional vector corresponding to the first location information and the first distance information whose similarity to the second location information and the second distance information is greater than or equal to the first threshold.
4. The approximate nearest neighbor search method according to claim 3, Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors includes: Search among the N D-dimensional vectors for the first D-dimensional vector that corresponds to the first location information and the first distance information with a similarity of more than the first threshold to the second location information and the second distance information, and whose distance to the query vector is less than the second distance.
5. The approximate nearest neighbor search method according to claim 4, Searching for the first D-dimensional vector from the N D-dimensional vectors includes: By excluding M D-dimensional vectors from the N D-dimensional vectors that correspond to the first distance information representing a distance greater than twice the second distance, NM D-dimensional vectors are obtained; and Search for the first D-dimensional vector from the NM D-dimensional vectors. M is an integer greater than or equal to 1.
6. The approximate nearest neighbor search method according to claim 5, Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors further includes: Calculate the third distance information representing the third distance between the first-dimensional vector and the query vector; The first range is determined by removing the range centered on the first reference vector and with a radius equal to the distance obtained by adding the third distance to the second distance from the first reference vector; By excluding the first D-dimensional vector and the L D-dimensional vectors located outside the first range from the NM D-dimensional vectors, NML-1 D-dimensional vectors are obtained. and Search from the NML-1 D-dimensional vectors for a second D-dimensional vector that corresponds to the first location information and the first distance information, whose similarity to the second location information and the second distance information is greater than the first threshold, and whose distance to the query vector is less than the third distance. L is an integer greater than or equal to 1.
7. The approximate nearest neighbor search method according to any one of claims 2 to 6, The N first-order distance information items each represent the Euclidean distance between the first reference vector and each of the N D-dimensional vectors. The second distance information represents the Euclidean distance between the first reference vector and the query vector.
8. The approximate nearest neighbor search method according to claim 1, Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors includes: Search among the N D-dimensional vectors for the first D-dimensional vector corresponding to the first location information whose similarity to the second location information is greater than or equal to the second location information.
9. The approximate nearest neighbor search method according to claim 8, Managing the N first-order location information includes: The azimuth information represented by the first difference vector is compressed by using the first difference vector obtained by subtracting the first reference vector from each of the N D-dimensional vectors, and the N first azimuth information are calculated. Calculating the second azimuth information includes compressing the azimuth information represented by the second difference vector obtained by subtracting the first reference vector from the query vector.
10. The approximate nearest neighbor search method according to claim 9, Regarding the management of the N first-order location information, when managing the first-order location information corresponding to the first D-dimensional vector among the N first-order location information, the following is included: R first part vectors are obtained from the first difference vector obtained by subtracting the first reference vector from the first D-dimensional vector; Convert the R first-part vectors into R first-bit values respectively; and Calculate the first orientation information, which includes the R first-order bit values and corresponds to the first D-dimensional vector. Calculating the second azimuth information includes: Based on the second difference vector, obtain R second part vectors; Convert the R second-part vectors into R second-bit values respectively; and Generate the second orientation information including the R second-bit values. R is an integer greater than or equal to 2.
11. The approximate nearest neighbor search method according to claim 10, Also includes: By calculating the Hamming distances between the second azimuth information and each of the N first azimuth information, N Hamming distances corresponding to the N D-dimensional vectors are obtained. Searching for the approximate nearest neighbor vector of the query vector includes: searching from the N D-dimensional vectors for the first D-dimensional vector that corresponds to a Hamming distance below the third threshold among the N Hamming distances.
12. The approximate nearest neighbor search method according to claim 11, Searching for the first D-dimensional vector from the N D-dimensional vectors includes: By excluding P D-dimensional vectors from the N D-dimensional vectors whose Hamming distances exceed the third threshold among the N Hamming distances, NP D-dimensional vectors are obtained; and Search for the first D-dimensional vector from the NP D-dimensional vectors. P is an integer greater than or equal to 1.
13. The approximate nearest neighbor search method according to claim 10, Each of the R partial vectors includes D / R elements. Converting the R partial vectors into R bit values includes: If the number of first elements greater than 0 is greater than the number of second elements less than 0 in the D / R elements, the corresponding partial vector is converted to 1; if the number of first elements is less than the number of second elements, the corresponding partial vector is converted to 0.
14. The approximate nearest neighbor search method according to claim 10, Each of the R partial vectors includes D / R elements. Converting the R partial vectors into R bit values includes: If an element selected from the D / R elements according to certain rules is 0 or higher, the corresponding partial vector is converted to 1; if the element is less than 0, the corresponding partial vector is converted to 0.
15. The approximate nearest neighbor search method according to claim 10, Each of the R partial vectors includes D / R elements. Converting the R partial vectors into R bit values includes either of the following (1) and (2): (1) If the absolute value of the first sum of the positive elements in the D / R elements is greater than the absolute value of the second sum of the negative elements, the corresponding partial vector is converted to 1; if the absolute value of the first sum is less than the absolute value of the second sum, the corresponding partial vector is converted to 0. (2) If the first square of the positive elements in the D / R elements is greater than the second square of the negative elements, the corresponding partial vector is converted to 1; if the first square is less than the second square, the corresponding partial vector is converted to 0.
16. The approximate nearest neighbor search method according to claim 1, further comprising: Manage N pre-acquired third-direction information, each of the N third-direction information representing the direction from the D-dimensional second reference vector to the respective direction of the N D-dimensional vectors; and Calculate the fourth azimuth information representing the azimuth 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: using the N first-position information, the second-position information, the N third-position information, and the fourth-position information to search for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors.
17. The approximate nearest neighbor search method according to claim 16, further comprising: By calculating the Hamming distance between the second azimuth information and each of the N first azimuth information, the N first Hamming distances corresponding to the N D-dimensional vectors are obtained. and By calculating the Hamming distances between the fourth azimuth information and each of the N third azimuth information, we obtain the N second Hamming distances corresponding to the N D-dimensional vectors. Searching for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors includes: searching for the first D-dimensional vector from the N D-dimensional vectors whose sum of the first Hamming distance and the second Hamming distance is less than the fourth threshold.
18. The approximate nearest neighbor search method according to claim 1, further comprising: Manage multiple clusters, each having multiple reference vectors, the multiple clusters including upper-level clusters and multiple lower-level clusters, the multiple lower-level clusters including a first lower-level cluster having the first reference vector; Manage multiple pre-acquired fifth-position information, each of the multiple fifth-position information representing the orientation from the upper-level reference vector of the upper-level cluster to the lower-level reference vector of each of the multiple lower-level clusters; Calculate the sixth azimuth information representing the orientation from the upper-level reference vector to the query vector; and Using the plurality of fifth-position information and the sixth-position information, the lower-level reference vector closest to the query vector is determined from the lower-level reference vectors of each of the plurality of lower-level clusters, and the lower-level clusters having the determined lower-level reference vector are searched as approximate nearest neighbor clusters. The determined lower-level reference vector is the first reference vector. The approximate nearest neighbor cluster is the first lower-level cluster. The N D-dimensional vectors belong to the first lower-level cluster.
19. The approximate nearest neighbor search method according to claim 18, further comprising: Manage multiple fourth distance information obtained in advance, each of the multiple fourth distance information representing the distance between the upper-level reference vector and the lower-level reference vector of each of the multiple lower-level clusters; Calculate the fifth distance information representing the distance between the upper-level reference vector and the query vector; and Using the plurality of fifth-positional information, the plurality of fourth-distance information, the sixth-positional information, and the fifth-distance information, the lower-level reference vector closest to the query vector is determined from the lower-level reference vectors of each of the plurality of lower-level clusters, and the lower-level cluster having the determined lower-level reference vector is searched as the approximate nearest neighbor cluster.
20. An approximate nearest neighbor search system, comprising: Main memory; A secondary storage device, configured as a vector database, wherein the vector database stores N D-dimensional vectors; and The processor, which has access to the main memory and the secondary storage device, The processor is configured such that, The system manages N pre-acquired first-order location information points, each of which represents the location from a D-dimensional first-order reference vector to the respective location of the N D-dimensional vectors. Receive a D-dimensional query vector for performing an approximate nearest neighbor search on the vector database. Calculate the second azimuth information, which represents the azimuth from the first reference vector to the query vector. Using the N first-order location information and the second-order location information, search for the approximate nearest neighbor vector of the query vector from the N D-dimensional vectors. N is an integer greater than or equal to 2. D is an integer greater than or equal to 2.