Computing device and approximate nearest neighbor searching method
Patent Information
- Application Number
- TW114107668
- Authority / Receiving Office
- TW · TW
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2025-02-11
- Filing Date
- 2025-03-03
- Publication Date
- 2026-08-16
- Estimated Expiration
- 2045-03-02
AI Technical Summary
Large Language Models (LLMs) require significant fast memory for vector searches using pre-built indexes, increasing hardware costs.
Implement a computing device with a K-means tree index and proximity graphs stored in slower but cheaper storage, loading only necessary data into RAM for approximate nearest neighbor searches.
Reduces RAM usage while maintaining search accuracy by minimizing the amount of data stored in fast memory during vector searches.
Smart Images

Figure TWG2TA001072387_001 
Figure TWG2TA001072387_002 
Figure TWG2TA001072387_003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a computing apparatus for performing Approximate Nearest Neighbor search (ANNs), and particularly to an approximate nearest neighbor search method. [Previous Technology]
[0002] Currently, for Large Language Models (LLMs), a Retrieval Augmented Generation (RAG) architecture is applied to use vector searches on different types of reference datasets, such as Approximate Nearest Neighbor Search (ANNs), to enable the LLM to generate more accurate answers based on these reference datasets. Using pre-built indexes corresponding to the datasets for vector searches requires a large amount of fast memory, such as random access memory (RAM), which increases hardware costs. Therefore, there is a need for techniques that can reduce the use of fast memory in vector searches. [Summary of the Invention]
[0003] A computer system having software, firmware, hardware, or a combination thereof installed in the system enables the system to perform and / or control the operations and / or actions during operation. A computer program containing instructions enables a device to perform specific operations and / or actions when executed.
[0004] A first aspect of this disclosure provides a computing device for performing an approximate nearest neighbor (ANN) search. The computing device includes a processor. The computing device also includes memory loaded with a k-means tree index. The k-means tree index corresponds to a plurality of vectors and has a plurality of layers from a root layer to a leaf layer, and each of the plurality of layers has one or more nodes. The computing device also includes a storage device coupled to the processor and the memory for storing one or more proximity graphs corresponding to one or more nodes in the leaf layers of the k-means tree index, and multiple vector sets stored in each of the multiple proximity graphs. When the processor performs an approximate nearest neighbor search, the processor executes a search instruction receiving a query vector. The processor also executes the process of sequentially retrieving the node with the shortest distance to the query vector from one or more nodes in each of the multiple layers of the K-means tree index, from the root layer to the leaf layer, until the result node located in the leaf layer is obtained. The processor also causes memory to load the proximity graph corresponding to the result node from storage. The processor also performs the process of retrieving the set of nearest vectors with the shortest distance to the query vector from multiple vector sets according to the proximity graph. The processor also causes memory to load the content of the set of nearest vectors corresponding to the set of nearest vectors from storage. The processor also performs the process of outputting the detailed vector data located in the set of nearest vectors as the query result. Other embodiments of this aspect include corresponding computer systems, devices, and computer programs recorded in one or more computer storage devices, each used to implement the operation of this method.
[0005] A second aspect of this disclosure provides an approximate nearest point search method for a computing device. The computing device includes a processor, memory, and storage. The approximate nearest point search method includes causing the processor to load a K-means tree index into the memory. The K-means tree index corresponds to multiple vectors. The approximate nearest point search method also includes causing the processor to sequentially retrieve the node with the shortest distance to the query vector from one or more nodes in each layer of the K-means tree index from the root layer to the leaf layer, until a result node located in the leaf layer is obtained. The approximate nearest point search method also includes causing the processor to load the memory into one or more proximity graphs stored in the storage, corresponding to the proximity graph of the result node. The approximate nearest point search method also includes causing the processor to retrieve the set of nearest vectors with the shortest distance to the query vector from multiple vector sets in the proximity graph, and causing the memory to load the set of nearest vectors corresponding to the set of nearest vectors stored in the storage. The approximate nearest point search method also includes using a processor to retrieve and output detailed vector data from multiple vectors that are located within the nearest vector set as query results. Multiple proximity graphs correspond to one or more nodes in the leaf layer, and multiple vector sets correspond to multiple vector sets in the proximity graphs. Other embodiments in this regard include corresponding computer systems, devices, and computer programs recorded on one or more computer storage devices, each used to perform the actions of this method.
[0006] A third aspect of this disclosure provides a computing device for performing an approximate nearest-point search. The computing device includes a processor for processing multiple vectors and generating spatial partitioning data. The spatial partitioning data includes a K-means tree index corresponding to the multiple vectors, the K-means tree index having multiple layers from a root layer to a leaf layer, and having one or more nodes in each of the multiple layers. The spatial partitioning data also includes one or more proximity graphs, corresponding to one or more nodes in the leaf layers of the K-means tree index, each of the one or more proximity graphs having multiple vector sets; the spatial partitioning data also includes multiple vector set contents, corresponding to multiple vector sets in each of the one or more proximity graphs. The computing device also includes memory for loading the K-means tree index. The computing device includes storage for storing the one or more proximity graphs and the multiple vector set contents. When the processor performs an approximate nearest-point search, the processor executes a search instruction receiving a query vector. The processor also executes the process of sequentially retrieving the node with the shortest distance to the query vector from one or more nodes in each of the multiple layers of the K-means tree index, from the root layer to the leaf layer, until the result node located in the leaf layer is obtained. The processor also causes memory to load the proximity graph corresponding to the result node from storage. The processor also performs the process of retrieving the set of nearest vectors with the shortest distance to the query vector from multiple vector sets according to the proximity graph. The processor also causes memory to load the content of the set of nearest vectors corresponding to the set of nearest vectors from storage. The processor also performs the process of outputting the detailed vector data located in the set of nearest vectors as the query result. Other embodiments of this aspect include corresponding computer systems, devices, and computer programs recorded in one or more computer storage devices, each used to implement the operation of this method.
[0007] Other features, aspects, and advantages will become clearer through the embodiments, drawings, and claims. To provide a better understanding of the above and other aspects of the present invention, specific embodiments are described below in conjunction with the accompanying drawings:
Implementation Method
[0008] This document describes one or more flowcharts. The processes described in the flowcharts are implementable and / or directly programmable processors that use computer programs stored in accessible memory of a computer system and executable by the processor, use dedicated logic hardware (including field programmable integrated circuits (FPGAs)), and use various combinations thereof. Multiple actions are composable, can be executed in parallel, and / or can be executed in different orders without affecting the achieved process. In some cases, rearranged multiple actions can achieve the same result only if certain other changes are also made simultaneously. In other cases, rearranged multiple actions can achieve the same result only if specific conditions are met. Furthermore, for clarity, some flowcharts herein omit certain unnecessary actions to understand the disclosed technology. Multiple additional actions can be performed before, after, and / or between the described actions.
[0009] Figure 1 illustrates a schematic diagram of an example computing device 100 according to one or more embodiments of the present disclosure; Figure 2 illustrates a schematic diagram of a K-means tree index 200 and a corresponding proximity graph 210 and vector set 212 according to one or more embodiments of the present disclosure; and Figure 3 illustrates a schematic diagram of the central block data table 300 and the data content in the vector set 212 of the proximity graph 210 according to one or more embodiments of the present disclosure.
[0010] Referring also to Figures 1 to 3, the computing device 100 includes a processor 110, RAM 120, memory 130 and I / O 140, all of which are coupled via bus / interface 150.
[0011] Processor 110 may include one or more processing units, such as hardware units capable of executing programmed instructions, microprocessors, signal processors, graphics processors, AI processors, and any combination of the like. The one or more processing units may selectively include one or more internal registers (some of which are selectively architecturally visible), one or more caches, and / or one or more internal memories (e.g., relating to buffering and / or merging), as represented by registers, caches, and internal memories 112. In some embodiments, processor 110 may process multiple vectors in a large amount of vector data and generate spatial partitioning data based on these vectors. The spatial partitioning data includes indices generated corresponding to the large amount of vectors, such as the K-means tree index 200 in Figure 2. The K-means tree index is generated using Microsoft's Space Partition Tree and Graph (SPTAG) algorithm and has multiple layers from the root layer to the leaf layer. Each layer has a different number of nodes. The example K-means tree index 200 in Figure 2 has three levels, from the root level 201-1 to the leaf level 201-3. The root level 201-1 has node 201-1-1, the second level 201-2 has nodes 201-2-1 to 201-2-3, and the leaf level 201-3 has nodes 201-3-1 to 201-3-9, but this is not a limitation. As shown in Figure 2, from the root level 201-1 to the leaf level 201-3, each level (except the leaf level) has one or more corresponding nodes in the lower level. Spatial partitioning data also includes multiple relative neighborhood graphs (RNGs) corresponding to multiple nodes in the leaf level of the K-means tree index, such as the relative neighborhood graph 210 corresponding to node 201-3-4 in the leaf level 201-3 of the K-means tree index 200, as shown in Figure 2. Each proximity graph contains multiple vector sets, meaning each vector set contains partial vectors of multiple vectors from a large amount of vector data, such as vector set 212 in Figure 2. The spatial partitioning data also includes posting list content corresponding to each vector set, such as posting list content 220 in Figure 3. Each posting list content contains relevant information about the aforementioned partial vectors located within that vector set. In some embodiments, after generating the spatial partitioning data, the processor 110 instructs RAM 120 to load a K-means tree index (e.g., K-means tree index 200) and instructs memory 130 to store multiple proximity graphs and multiple vector set contents corresponding to the leaf layers of the K-means tree index.
[0012] RAM 120 may include one or more DRAM devices for storing instructions and / or data, the amount of which is greater than the memory of processor 110. RAM 120 may be used to load a K-means tree index (e.g., K-means tree index 200) for vector search (e.g., approximate nearest search), and to load necessary data required for performing vector search (e.g., approximate nearest search) by commands from processor 110, such as the corresponding values of multiple proximity graphs and multiple vector sets stored in memory 130.
[0013] Storage 130 includes one or more storage elements, such as an SSD based on a flash-based storage element or an HHD based on a rotating magnetic and / or optical non-volatile storage element (e.g., a platter), for storing instructions and / or data. Compared to an HDD, an SSD can have less latency in access but stores less data. The cost per unit of storage in storage 130 is lower than the cost per unit of storage in RAM 120. As discussed above, the techniques provided according to various embodiments of this disclosure allow multiple proximity graphs and multiple vector sets to be stored in storage 130 without preloading all proximity graphs into RAM 120, thus reducing the usage of RAM 120. In some embodiments, the proximity graph is stored in fixed blocks in storage 130 as data segments, such as the central block data table 300 of vector set 212 in proximity graph 210 of Figure 3. The central block data table of each vector set in the proximity graph includes the central vector ID, full-precision vector contents, vector set contents, and central vector IDs of each of the multiple adjacent vector sets. For example, the central block data table 300 of vector set 212 in proximity graph 210 includes the central vector ID 301, full-precision vector contents 302, vector set contents 303, and central vector IDs of each of the multiple adjacent vector sets (adjacent vector set central vector IDs 304-1 to 304-n). The data stored in the vector set contents in storage 130 includes the vector set table ID, which contains full-precision vector contents of all vectors in the corresponding vector set in the vector set table, or the vector set table ID and full-precision vector contents of all vectors in the corresponding vector set. For example, the vector set content 220 corresponding to the vector set content 303 of the central block data table 300 includes detailed vector data (detailed vector data 222-1 to detailed vector data 222-n) of all vectors contained in the vector set table ID 221 and vector set 212.
[0014] I / O 140 includes elements capable of connecting any combination of processor 110, RAM 120, and / or storage 130 to external components of computing device 100. Examples of external components include a large number of storage devices, local or wide area networks (e.g., the Internet), human-machine interface components (e.g., keyboard, mouse, and / or monitor), and other components providing capabilities to extend and / or enhance capabilities not provided by computing device 100. In some embodiments, I / O 140 may be used to receive search instructions including a query vector or output query results from vector searches (e.g., approximate nearest-point searches) generated by processor 110.
[0015] Bus / interface 150 enables communication between components coupled thereto (e.g., processor 110, RAM 120, memory 130, and / or I / O 140). Bus / interface 150 includes one or more serial and / or parallel communication channels in various ways, as well as selective protocol conversion and / or adaptation capabilities to enhance communication between components coupled thereto.
[0016] Depending on the application requirements, other partitioning of the components shown in the figure, coupling between components, and the capabilities and / or capacity of the components, as well as other additional components, may be considered.
[0017] When performing a vector search (e.g., an approximate nearest point search), only the data required is loaded into memory, such as RAM 120. When the search operation accesses the various levels of the K-means tree index, such as K-means tree index 200, the K-means tree index (or a specific block of the K-means tree index), the corresponding proximity graph, and / or the corresponding vector set content are sequentially loaded from memory, such as memory 130, into memory, such as RAM 120. In other words, only the data required for the continued search operation is retained in memory, while data that is not needed can be removed from memory by commands from the processor 110, thus saving memory usage. For example, when the search operation reaches node 201-2-2 of the second level 201-2 of the K-means tree index 200, only node 201-2-2 of the second level 201-2 of the K-means tree index 200 and the blocks corresponding to nodes 201-3-4 to 201-3-6 of node 201-2-2 in the leaf layer 201-3 are retained in RAM 120, and the rest of the K-means tree index 200 is removed from RAM 120. The search operation based on the computing device 100 in Figure 1, the K-means tree index 200 in Figure 2, and the central block data table 300 and vector set content 220 in Figure 3 will be described in detail below with reference to Figure 4.
[0018] Figures 4A to 4C respectively illustrate the access of data for a search operation at different stages in memory (e.g., RAM 120 in Figure 1) according to one or more embodiments of the present disclosure. As shown in diagram (a) of Figure 4A, upon receiving a search instruction with a query vector, the processor may cause the memory to load the entire K-means tree index 200 to sequentially find the node with the shortest distance to the query vector, starting from node 201-1-1 at the root (topmost) of the K-means tree index 200. In this example, the node with the shortest distance to the query vector at the second level is node 201-2-2, and the node with the shortest distance to the query vector at the leaf level (bottommost) is node 201-3-4, which can be used as the result node, as shown in diagram (b) of Figure 4A. In other words, once the result node (node 201-3-4) is determined, all other information in the K-means tree index 200 except for the result node (node 201-3-4) can be removed from memory to save memory usage. In some implementations, when the node with the shortest distance to the query vector is obtained at each level, only the data of this node and its lower-level associated nodes in the K-means tree index can be retained, and other information in the K-means tree index can be removed from memory. For example, when the node 201-2-2 with the shortest distance to the query vector is obtained at the second level, only the data of node 201-2-2 and its lower-level associated nodes 201-3-4 to 201-3-6 in the K-means tree index 200 can be retained, and other information in the K-means tree index 200 can be removed from memory. By adjusting the data loaded into memory at different stages, the usage of fast memory can be effectively saved. In some implementations, the search instruction also includes a maximum length of the candidate list and a result size k, which can be used to adjust the output of the query results, where k is a positive integer greater than or equal to one.
[0019] Once the result node (node 201-3-4) is determined, the processor can cause the memory to load the proximity graph of the corresponding result node (node 201-3-4) from the storage. As discussed above, due to the technology provided by the various embodiments of this disclosure, the proximity graph is stored in the storage as a central block data table (e.g., the central block data table 300 in Figure 3) in the form of data segments. A starting vector set can be set in the multiple vector sets contained in each proximity graph as the starting point for comparing the distance between the query vector and the multiple vector sets contained in the proximity graph. Referring to Figure 4B, in this case, once the result node (node 201-3-4) is determined, the processor can cause the memory to load only the starting central block data table 300s of the starting vector set 212s in the proximity graph 210 of the corresponding result node (node 201-3-4), for example, loading the priority queue in the memory, which can also save memory usage. The starting center block data table 300s contains detailed center vector data 302s of the starting vector set 212s and center vector IDs (nearby vector set center vector IDs 304s-1 to 304s-n) of neighboring vector sets adjacent to the starting vector set 212s. Using this information, related center block data tables for these neighboring vector sets (as confirmed neighboring vector sets) can be obtained, for example, by loading them into a storage queue in memory. Furthermore, the neighboring vector set with the shortest distance to the query vector can be determined using the detailed center vector data in each center block data table. In some embodiments, after obtaining multiple center block data tables corresponding to multiple neighboring vector sets based on the starting center block data table 300s (completing the neighboring vector set confirmation), the starting center block data table 300s of the starting vector set 212s can be removed from the priority queue (memory), and the starting vector set 212s can be marked as confirmed, as shown in the lower part of Figure 4B.
[0020] After obtaining the nearest vector set with the shortest distance to the query vector among multiple nearest vector sets, this nearest vector set can be set as the starting vector set, and the above operation can be repeated until the nearest vector set 212r with the shortest distance to the query vector in the proximity graph 210 is obtained, as shown in Figure 4C. In some embodiments, whenever a nearest vector set is set as the starting vector set, and the central block data table (as the starting central block data table) corresponding to the nearest vector set is loaded into the priority column in memory, multiple detailed vector data of the corresponding vector set content of this nearest vector set can be added from storage to the candidate list set in memory according to the vector set table ID in the corresponding central block data table, and the candidate can be used as the query result, for example, when this nearest vector set is already the nearest vector set with the shortest distance to the query vector in the proximity graph. During such a search process, the detailed vector data in the candidate list will continue to accumulate. When the amount of data accumulates to a length greater than the maximum length of the candidate list in the search instruction, redundant detailed vector data that are far from the query vector can be removed from the candidate list in memory.
[0021] Returning to Figure 4C, once the nearest vector set 212r with the shortest distance to the query vector in the proximity graph 210 is determined, the processor can cause the memory to load the result center block data table 300r corresponding to the nearest vector set 212r from the storage, and load the corresponding nearest vector set content 220r from the storage according to the vector set content 303r in the result center block data table 300r. Multiple detailed vector data (detailed vector data 220r-1 to detailed vector data 220r-n) in the nearest vector set content 220r are similarly added to the candidate list set in memory. Finally, the processor can select the k detailed vector data closest to the query vector from the candidate list as the query results and output them, based on the number of results k.
[0022] Figure 5 illustrates a flowchart of a procedure for approximate nearest point search for a computing device according to one or more embodiments of the present disclosure. In step S510, for example, the processor causes memory to load a K-means tree index corresponding to multiple vectors. In step S520, for example, the processor sequentially retrieves the node with the shortest distance to the query vector from multiple nodes in each layer of the K-means tree index from the root layer to the leaf layer, until a result node located in the leaf layer is obtained. In step S530, for example, the processor causes memory to load a proximity graph corresponding to the result node from multiple proximity graphs stored in memory. The multiple proximity graphs each correspond to multiple nodes in the leaf layer. In step S540, for example, the processor retrieves the set of nearest vectors with the shortest distance to the query vector from multiple vector sets in the proximity graph, and causes memory to load the set of nearest vectors corresponding to the set of nearest vectors stored in memory. The contents of multiple vector sets correspond to multiple vector sets in the proximity graph. In step S550, for example, a processor takes the detailed vector data located in the nearest vector set from the multiple vectors and outputs it as the query result.
[0023] In some specific settings, each of one or more proximity graphs is stored in storage in the form of multiple central block data tables. Each of the multiple central block data tables includes the central vector ID, detailed vector data of the central vector, corresponding vector set content, and central vector ID of multiple adjacent vector sets for each of the one or more proximity graphs. The corresponding vector set content includes a vector set table ID and detailed vector data of multiple vectors contained in one of the multiple vector sets corresponding to the corresponding vector set content, or a vector set table ID including a vector data table with multiple detailed vector data.
[0024] In certain specific settings, the vectors contained in multiple vector sets within one or more proximity graphs may be a center vector and multiple neighboring vectors. The center vector is used to calculate the distance between the query vector and each of the multiple vector sets. Each center vector of each of the multiple vector sets is associated with a corresponding one of the multiple center block data tables.
[0025] In some specific configurations, multiple vector sets in one or more proximity graphs have an initial vector set and one or more neighboring vector sets coupled to the initial vector set. The processor obtains the nearest vector set with the shortest distance to the query vector from the multiple vector sets by: obtaining the nearest vector set with the shortest distance to the query vector from one or more neighboring vector sets according to the initial central block data table corresponding to the initial vector set in multiple central block data tables; causing memory to load the vector set content corresponding to the neighboring vector set from the contents of the multiple vector sets; and setting the neighboring vector set as the initial vector set and repeating the above operations until the nearest vector set with the shortest distance to the query vector is obtained in the proximity graph.
[0026] In some specific settings, the processor obtains the set of neighboring vectors with the shortest distance to the query vector based on the starting central block data table and causes the memory to load the vector set content corresponding to the neighboring vector set from the storage of multiple vector set contents, including: causing the memory to load the starting central block data table of the starting vector set in the corresponding proximity graph from the storage; setting the starting vector set in the priority queue in the memory; setting one or more central block data tables corresponding to one or more neighboring vector sets in the storage queue based on the starting central block data table, removing the starting central block data table of the starting vector set from the priority queue, and marking the starting vector set as confirmed; and obtaining the set of neighboring vectors with the shortest distance to the query vector based on the one or more central block data tables corresponding to the one or more neighboring vector sets set in the storage queue, and causing the memory to load the vector set content corresponding to the neighboring vector set from the storage.
[0027] In some specific settings, the search instruction also includes the maximum length of the candidate list and the number of results k. k is a positive integer greater than or equal to one. When the processor obtains the nearest neighbor vector to the query vector in a set of neighbor vectors each time, it adds multiple detailed vector data from the vector set corresponding to the neighbor vector to the candidate list in memory, until it obtains the nearest vector set to the query vector in the proximity graph, and adds multiple detailed vector data from the nearest vector set corresponding to the nearest vector set to the candidate list. When the multiple detailed vector data in the candidate list exceeds the maximum length, redundant detailed vector data that are far from the query vector are removed from the candidate list in memory. Based on the number of results k, the processor selects the k detailed vector data that are closest to the query vector from the candidate list as the query results.
[0028] The technology provided by the various embodiments disclosed herein can improve vector search algorithms, such as the SPTAG algorithm, to minimize memory usage. By storing the data corresponding to the tree index in memory, memory usage can be reduced when performing vector searches. Furthermore, by adjusting the data to be loaded into memory at different stages during retrieval, memory usage can be reduced while latency is decreased and search accuracy is maintained.
[0029] Examples of fast memory technologies applicable to memory as described herein include floating gate, discrete gate, SONOS, floating dot memory, DRAM, DRAM-like (e.g., 2T0C), FeFET, and any memory technology compatible with word line and bit line search. Example SONOS memory technology (sometimes called charge-capture memory) uses an insulating layer (e.g., silicon nitride) with traps to capture and retain charge emitted from the channel. Example floating dot memory technology conceptually replaces the floating gate in a polysilicon gate with floating silicon nanodots, or embedded floating silicon nanodots. Example 2T0C memory technology uses the parasitic capacitance of the read transistor to store charge instead of an external storage capacitor. Example FeFET memory technology uses permanent electric field polarization of a ferroelectric material embedded between the gate and source-gate conduction regions to store information.
[0030] It is understood that although the present invention has been disclosed above by way of implementation, variation, embodiment and example, it is not intended to limit the present invention. Those skilled in the art to which this invention pertains can make various modifications and refinements without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be determined by the appended claims. [Simplified Explanation of the Diagram]
[0031] Figure 1 illustrates a schematic diagram of an example computing device according to one or more embodiments of the present disclosure. Figure 2 illustrates a schematic diagram of a K-means tree index and a corresponding proximity graph and vector set contents according to one or more embodiments of the present disclosure. Figure 3 illustrates a schematic diagram of the central block data table of each vector set in the proximity graph according to one or more embodiments of the present disclosure and the data contents in the vector set contents. Figures 4A to 4C respectively illustrate schematic diagrams of data access in memory at different stages for a search operation according to one or more embodiments of the present disclosure. Figure 5 illustrates a flowchart of a procedure for approximate nearest point search for a computing device according to one or more embodiments of the present disclosure.
Claims
1. A computing device for performing an approximate nearest neighbor (ANN) search, comprising: One processor; A memory loaded with a K-means tree index, wherein the K-means tree index corresponds to a plurality of vectors, and the K-means tree index has a plurality of layers from a root layer to a leaf layer, and each of the layers has one or more nodes; and a storage device coupled to the processor and the memory for storing one or more proximity graphs corresponding to the one or more nodes of the leaf layer of the K-means tree index, and storing multiple sets of vectors in each of the multiple proximity graphs, wherein when the processor performs the approximate nearest point search, the processor performs: receiving a search instruction having a query vector; sequentially obtaining the node with the shortest distance to the query vector from the one or more nodes in each of the layers from the root layer to the leaf layer of the K-means tree index, until a result node located in the leaf layer is obtained. The memory is caused to load a proximity graph corresponding to the result node from one or more proximity graphs; based on the proximity graph, the nearest vector set with the shortest distance to the query vector is obtained from the vector sets; the memory is caused to load the nearest vector set content corresponding to the nearest vector set from the contents of the vector sets; and the plurality of detailed vector data located in the nearest vector set content are output as a query result.
2. The computing apparatus as claimed in claim 1, wherein each of the one or more proximity graphs is stored in the memory in the form of a plurality of central block data tables, each of the central block data tables including a central vector ID corresponding to each of the vector sets in the one or more proximity graphs, a central vector detailed vector data, a corresponding vector set content in the vector set content, and a plurality of adjacent vector set central vector IDs, wherein the corresponding vector set content includes a vector set table ID and a plurality of detailed vector data of a plurality of vectors contained in one of the vector sets corresponding to the corresponding vector set content, or the vector set table ID including a vector data table having the detailed vector data.
3. The computing apparatus as claimed in claim 2, wherein each of the vector sets in one or more proximity graphs comprises a central vector and a plurality of neighboring vectors, the central vector being used to calculate the distance between the query vector and each of the vector sets, wherein each of the central vectors of each of the vector sets is associated with a corresponding one of the central block data tables.
4. The computing apparatus as claimed in claim 3, wherein each of the vector sets in the one or more proximity graphs has an initial vector set and one or more neighbor vector sets coupled to the initial vector set, wherein the processor obtains the nearest vector set that has the shortest distance to the query vector from the vector sets by: Based on the starting central block data table corresponding to the starting vector set in the central block data table, obtain the nearest vector set that is closest to the query vector in one or more nearest vector sets; cause the memory to load the vector set content corresponding to the nearest vector set from the contents of the vector sets; and set the nearest vector set as the starting vector set and repeat the above operation until the nearest vector set that is closest to the query vector in the proximity graph is obtained.
5. The computing apparatus as claimed in claim 4, wherein the processor obtains, based on the starting central block data table, the set of neighboring vectors that is closest to the query vector, and causes the memory to load from the storage the vector set contents corresponding to the neighboring vector set, the vector set contents comprising: The process involves: loading the starting center block data table corresponding to the starting vector set in the proximity graph from the memory; setting the starting vector set in a priority queue in the memory; setting one or more center block data tables corresponding to the one or more neighboring vector sets in a storage queue in the memory based on the starting center block data table, removing the starting center block data table of the starting vector set from the priority queue, and marking the starting vector set as confirmed; and obtaining the neighboring vector set with the shortest distance to the query vector based on the one or more center block data tables corresponding to the one or more neighboring vector sets set in the storage queue, and causing the memory to load the vector set content corresponding to the neighboring vector set from the memory.
6. The computing device as described in claim 5, wherein the search instruction further includes a maximum length of a candidate list and a result size k, wherein k is a positive integer greater than or equal to one, wherein when the processor obtains the nearest vector to the query vector in a set of nearest vectors each time, it adds a plurality of detailed vector data from the contents of the vector set corresponding to the nearest vector to the candidate list in memory, until the nearest vector set to the query vector is obtained in the proximity graph, and adds a plurality of detailed vector data from the contents of the nearest vector set corresponding to the nearest vector set to the candidate list, wherein when the detailed vector data in the candidate list is greater than the maximum length, redundant detailed vector data that are far from the query vector are removed from the candidate list in memory, wherein the processor, based on the result size k, selects the k detailed vector data closest to the query vector from the candidate list as the query result.
7. An approximate nearest point search method for a computing device, wherein the computing device includes a processor, a memory, and a storage device, the approximate nearest point search method comprising: The processor causes the memory to load a K-means tree index, where the K-means tree index corresponds to a plurality of vectors; the processor sequentially retrieves the node with the shortest distance to a query vector from one or more nodes in each layer of the K-means tree index, from a root layer to a leaf layer, until a result node is obtained in the leaf layer; the processor causes the memory to load a proximity graph corresponding to the result node, stored in one or more proximity graphs in the memory; the processor retrieves the set of nearest vectors with the shortest distance to the query vector from the plurality of vector sets in the proximity graph, and causes the memory to load the set of nearest vectors corresponding to the set of nearest vectors, stored in the memory; and the processor outputs the plurality of detailed vector data located in the set of nearest vectors as a query result. The one or more proximity graphs correspond to the one or more nodes in the leaf layer, and the contents of the vector sets correspond to the vector sets in each of the one or more proximity graphs.
8. The approximate nearest point search method as described in claim 7, wherein each of the one or more proximity graphs is stored in the storage in the form of a plurality of central block data tables, each of the central block data tables including a central vector ID corresponding to each of the vector sets in the one or more proximity graphs, a central vector detailed vector data, a corresponding vector set content in the vector set content, and a plurality of adjacent vector set central vector IDs, wherein the corresponding vector set content includes a vector set table ID and a plurality of detailed vector data of a plurality of vectors contained in one of the vector sets corresponding to the corresponding vector set content, or the vector set table ID including a vector data table having the detailed vector data.
9. The approximate nearest point search method as described in claim 8, wherein each of the vector sets in one or more proximity graphs contains a central vector and a plurality of neighboring vectors, the central vector being used to calculate the distance between the query vector and each of the vector sets, wherein each of the central vectors in each of the vector sets is associated with a corresponding one of the central block tables.
10. The approximate nearest point search method as described in claim 9, wherein each of the vector sets in the one or more proximity graphs has a starting vector set and one or more neighbor vector sets coupled to the starting vector set, wherein the processor obtains the nearest vector set that has the shortest distance to the query vector from the vector sets by: Based on the starting central block data table corresponding to the starting vector set in the central block data table, obtain the nearest vector set that is closest to the query vector in one or more nearest vector sets; cause the memory to load the vector set content corresponding to the nearest vector set from the contents of the vector sets; and set the nearest vector set as the starting vector set and repeat the above operation until the nearest vector set that is closest to the query vector in the proximity graph is obtained.
11. The approximate nearest point search method as described in claim 10, wherein the processor obtains the set of neighboring vectors that are closest to the query vector based on the starting center block data table, and causes the memory to load the vector set contents corresponding to the neighboring vector set from the storage, comprising: The process involves: loading the starting center block data table corresponding to the starting vector set in the proximity graph from the memory; setting the starting vector set in a priority queue in the memory; setting one or more center block data tables corresponding to the one or more neighboring vector sets in a storage queue based on the starting center block data table, removing the starting center block data table of the starting vector set from the priority queue, and marking the starting vector set as confirmed; and obtaining the neighboring vector set with the shortest distance to the query vector based on the one or more center block data tables corresponding to the one or more neighboring vector sets set in the storage queue, and causing the memory to load the vector set content corresponding to the neighboring vector set from the memory.
12. The approximate nearest point search method as described in claim 11, wherein the search instruction further includes a maximum length of a candidate list and a result quantity k, wherein k is a positive integer greater than or equal to one, wherein when the processor obtains the nearest vector with the shortest distance to the query vector in a set of neighboring vectors each time, it adds a plurality of detailed vector data from the contents of the vector set corresponding to the neighboring vector to the candidate list in memory, until the nearest vector set with the shortest distance to the query vector in the proximity graph is obtained, and adds a plurality of detailed vector data from the contents of the nearest vector set corresponding to the nearest vector set to the candidate list, wherein when the detailed vector data in the candidate list is greater than the maximum length, redundant detailed vector data that is far from the query vector is removed from the candidate list in memory, wherein the processor selects the k detailed vector data that are closest to the query vector from the candidate list as the query result based on the result quantity k.
13. A computing device for performing an approximate nearest point search, comprising: A processor is configured to process a plurality of vectors and generate spatial partitioning data, wherein the spatial partitioning data includes: a K-means tree index corresponding to the vectors, the K-means tree index having a plurality of layers from a root layer to a leaf layer, and having one or more nodes in each of the layers; one or more proximity graphs corresponding to the one or more nodes in the leaf layer of the K-means tree index, each of the one or more proximity graphs having a plurality of vector sets; and a plurality of vector set tables corresponding to the vector sets in each of the one or more proximity graphs; a memory for loading the K-means tree index; and a storage for storing the one or more proximity graphs and the vector set tables, wherein when the processor performs the approximate nearest point search, the processor performs: receiving a search instruction having a query vector; Sequentially, from the root layer to the leaf layer of the K-means tree index, the node with the shortest distance to the query vector is obtained until a result node is obtained in the leaf layer. This causes the memory to load a proximity graph corresponding to the result node from the storage. Based on the proximity graph, the nearest vector set with the shortest distance to the query vector is obtained from the vector sets. This causes the memory to load the nearest vector set content corresponding to the nearest vector set from the storage. And the plurality of detailed vector data located in the nearest vector set content are output as a query result.
14. The computing apparatus of claim 13, wherein each of the one or more proximity graphs is stored in the memory in the form of a plurality of central block data tables, each of the central block data tables including a central vector ID corresponding to each of the vector sets in the one or more proximity graphs, a central vector detailed vector data, a corresponding vector set content in the vector set content, and a plurality of adjacent vector set central vector IDs, wherein the corresponding vector set content includes a vector set table ID and a plurality of detailed vector data of a plurality of vectors contained in one of the vector sets corresponding to the corresponding vector set content, or the vector set table ID including a vector data table having the detailed vector data.
15. The computing apparatus of claim 14, wherein each of the plurality of vector sets in each of the one or more proximity graphs comprises a central vector and a plurality of neighboring vectors, the central vector being used to calculate the distance between the query vector and each of the vector sets, wherein each of the central vectors of each of the vector sets is associated with a corresponding one of the central block tables.
16. The computing apparatus of claim 15, wherein each of the vector sets in the one or more proximity graphs has a starting vector set and one or more neighboring vector sets coupled to the starting vector set, wherein the processor obtains the nearest vector set that has the shortest distance to the query vector from the vector sets by: Based on the starting central block data table corresponding to the starting vector set in the central block data table, obtain the nearest vector set that is closest to the query vector in one or more nearest vector sets; cause the memory to load the vector set content corresponding to the nearest vector set from the contents of the vector sets; and set the nearest vector set as the starting vector set and repeat the above operation until the nearest vector set that is closest to the query vector in the proximity graph is obtained.
17. The computing apparatus of claim 16, wherein the processor obtains, based on the starting central block data table, the set of nearest neighbor vectors that is closest to the query vector, and causes the memory to load from the storage the vector set contents corresponding to the set of nearest neighbor vectors, including: The process involves: loading the starting center block data table corresponding to the starting vector set in the proximity graph from the memory; setting the starting vector set in a priority queue in the memory; setting one or more center block data tables corresponding to the one or more neighboring vector sets in a storage queue in the memory based on the starting center block data table, removing the starting center block data table of the starting vector set from the priority queue, and marking the starting vector set as confirmed; and obtaining the neighboring vector set with the shortest distance to the query vector based on the one or more center block data tables corresponding to the one or more neighboring vector sets set in the storage queue, and causing the memory to load the vector set content corresponding to the neighboring vector set from the memory.
18. The computing device as claimed in claim 17, wherein the search instruction further includes a maximum length of a candidate list and a result quantity k, wherein k is a positive integer greater than or equal to one, wherein when the processor obtains the nearest vector in a set of neighboring vectors that is closest to the query vector, it adds a plurality of detailed vector data from the contents of the vector set corresponding to the neighboring vector to the candidate list in memory, until the nearest vector set in the proximity graph that is closest to the query vector is obtained, and adds a plurality of detailed vector data from the contents of the nearest vector set corresponding to the nearest vector set to the candidate list, wherein when the detailed vector data in the candidate list is greater than the maximum length, redundant detailed vector data that is far from the query vector is removed from the candidate list in memory, wherein the processor, based on the result quantity k, selects the k detailed vector data that are closest to the query vector from the candidate list as the query result.