Method and system for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology

By applying the triangular inequality pruning method in high-dimensional vector space, optimizing the nearest neighbor search of high-dimensional vectors, the problem of redundant calculation in traditional methods is solved, and the combination of efficient query and high retrieval accuracy is achieved.

CN119759967APending Publication Date: 2025-04-04RENMIN UNIVERSITY OF CHINA
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411859247.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In high-dimensional vector space, traditional vector search methods have a lot of redundant calculations, especially in high-precision search scenarios, where the computing resources for irrelevant data are wasted significantly, and cannot meet the efficient query requirements of large-scale high-dimensional vector data.

Method used

The pruning method based on triangular inequality is adopted, and through multi-level pruning strategies and optimized algorithm processes, the calculation amount is compressed, unnecessary distance calculation is reduced, and query efficiency is improved. The specific steps include pre-training the data set, dividing the data clusters, determining the query vector and nearest neighbor vector, and filtering the candidate vector using the triangular inequality pruning method, and finally obtaining the approximate nearest neighbor search results.

Benefits of technology

With high retrieval accuracy, the query efficiency is significantly improved, the computing burden is reduced, and it is suitable for efficient information retrieval of large-scale high-dimensional vector data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759967A_ABST
    Figure CN119759967A_ABST
Patent Text Reader

Abstract

The invention relates to a method and system for optimizing high-dimensional vector approximate nearest neighbor search based on a compression technology, and the method comprises the following steps: carrying out the pre-training of an original data set, and dividing the original data set to obtain a plurality of data clusters; determining a query vector Q and first K neighbor vectors of the query vector Q according to actual retrieval requirements; carrying out compression optimization on each data cluster by utilizing K neighbor vectors of the query vector Q and the positions of the data clusters based on a pruning method of a triangular inequality; and obtaining an approximate nearest neighbor search result of the query vector Q based on the compressed and optimized data cluster. The method can be widely applied to the technical field of vector databases and information retrieval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method and system for optimizing high-dimensional vector approximate nearest neighbor search (ANNS) based on compression technology, and belongs to the technical field of vector database and information retrieval. Background Art

[0002] With the rapid development of big data and artificial intelligence, how to efficiently process and store vector data has become a core task in the field of information retrieval. Vector data plays an important role in many application scenarios such as search engines, recommendation systems, image recognition, and natural language processing. These application scenarios usually require quickly finding the data points most similar to the query vector in a large number of high-dimensional vectors to support efficient information acquisition needs such as real-time recommendation and intelligent search.

[0003] As the size and dimension of data increase, vector databases face tremendous computational pressure. Traditional vector retrieval methods perform precise distance calculations on the entire data set, resulting in huge computational workloads and high resource consumption, which cannot meet the needs of efficient queries. To this end, approximate nearest neighbor search is widely used, dividing data into multiple subsets through clustering or partitioning, thereby reducing computational space and improving query efficiency. However, these methods still have a lot of redundant calculations in high-dimensional space, especially in high-precision retrieval scenarios, where the waste of computational resources for irrelevant data is particularly significant. Summary of the invention

[0004] In view of the above problems, the purpose of the present invention is to provide a method and system for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology. Based on the improved triangle inequality pruning method, through multi-level pruning strategies and optimized algorithm processes, the amount of calculation is further compressed to ensure efficient query with high retrieval accuracy to meet the needs of large-scale high-dimensional vector data.

[0005] To achieve the above object, the present invention adopts the following technical solutions: In a first aspect, the present invention provides a method for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology, comprising the following steps: Pre-train the original data set and divide it into multiple data clusters; Determine the query vector Q and the first K nearest neighbor vectors of the query vector Q according to the actual retrieval requirements; Based on the triangle inequality pruning method, the K nearest neighbor vectors of the query vector Q and the position of the data cluster are used to compress and optimize each data cluster. Based on the compressed and optimized data clusters, the approximate nearest neighbor search results of the query vector Q are obtained.

[0006] Furthermore, the triangle inequality-based pruning method uses the known neighborhood of the query vector Q and the location of the data cluster to perform compression optimization on each data cluster, including: The vector data in each data cluster is screened using the distance between the query vector Q and the pre-calculated cluster center C to obtain a first candidate vector set; Using the distance relationship between the query vector Q and some vectors in the first candidate vector set, the neighbors of the set are screened to obtain a second candidate vector set; The third candidate vector set is obtained by screening using the angular relationship between the K nearest neighbor vectors of the query vector Q and the second candidate vector set region.

[0007] Furthermore, the distance between the query vector Q and the pre-calculated cluster center C is used to screen the vector data in each data cluster to obtain a first candidate vector set, including: Calculate the distance D1 from the query vector Q to the cluster center C; The distance D1 is compared with a preset threshold value TopK, and the vector data in each data cluster is screened according to the comparison result to obtain a first candidate vector set.

[0008] Furthermore, the distance D1 is compared with a preset threshold value TopK, and the vector data in each data cluster is screened according to the comparison result, including: If the distance D1 is greater than the preset threshold TopK, it is considered that the vectors in the data cluster whose distance from the cluster center C is TopK-D1 cannot become the neighbors of the query vector Q. In this case, the vectors in the cluster that are closer to the cluster center C are directly excluded. If the distance D1 is less than the preset threshold TopK, all vectors in the data cluster are retained.

[0009] Furthermore, the use of the distance relationship between the query vector Q and some vectors in the first candidate vector set to screen the neighbors of the set to obtain the second candidate vector set includes: Calculate the distance D2 between the query vector Q and any vector P1 in the first candidate vector set; The distance D2 is compared with a preset threshold value TopK, and the vector data in the first candidate vector set is screened according to the comparison result to obtain a second candidate vector set.

[0010] Furthermore, the step of comparing the distance D2 with a preset threshold TopK and screening the vector data in the first candidate vector set according to the comparison result includes: If the distance between the query vector Q and any vector P1 in the first candidate vector set is greater than the current TopK threshold, then vector P1 itself is considered not to be a neighbor of the query vector Q and needs to be removed; at the same time, if the distance between vector P2 and vector P1 is within D2-TopK, then vector P2 is removed.

[0011] Furthermore, the method of using the angular relationship between the known neighborhood of the query vector Q and the second candidate vector set area to perform screening to obtain a third candidate vector set includes: Calculate the angle between the query vector Q and each vector in the second candidate vector set; Calculate the angle θ2 between the query vector Q and the TopK region; The angles between each vector in the second candidate vector set and the query vector Q are compared with θ2, and the vectors in the cluster are screened according to the comparison result to obtain a third candidate vector set.

[0012] In a second aspect, the present invention provides a system for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology, comprising: The data preprocessing module is used to pre-train the original data set and divide it into multiple data clusters, namely the query set; A query vector determination module is used to determine a query vector Q and the first K nearest neighbor vectors of the query vector Q according to actual retrieval requirements; A compression optimization module is used to compress and optimize each data cluster using the K nearest neighbor vectors of the query vector Q and the positions of the data clusters based on the pruning method of the triangle inequality; The result output module is used to obtain the approximate nearest neighbor search result of the query vector Q based on the compressed and optimized data cluster.

[0013] In a third aspect, the present invention provides a computer-readable storage medium storing one or more programs, wherein the one or more programs include instructions, which, when executed by a computing device, cause the computing device to perform any method.

[0014] In a fourth aspect, the present invention provides a computing device, comprising: one or more processors and a memory, wherein the memory stores one or more programs and is configured to be executed by the one or more processors, and the one or more programs include instructions for executing any method.

[0015] Due to the adoption of the above technical solution, the present invention has the following advantages: the present invention optimizes the approximate nearest neighbor search (ANNS) of high-dimensional vector data by using an efficient pruning compression method based on the triangle inequality, thereby reducing unnecessary distance calculations and greatly improving query efficiency. By using the geometric characteristics of the triangle inequality, the present invention can quickly compress the search space during the query process, reduce the computational burden by screening and excluding non-candidate vectors, and maintain retrieval accuracy and query speed.

[0016] Therefore, the present invention can be widely applied to the field of vector database and information retrieval technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Throughout the accompanying drawings, the same reference numerals are used to represent the same components. In the accompanying drawings: Figure 1 It is a flow chart of a method for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology provided by an embodiment of the present invention; Figure 2 This is a diagram showing the pruning effect of center distance compression provided by an embodiment of the present invention; Figure 3 This is a diagram showing the pruning effect of sub-neighborhood distance compression provided by an embodiment of the present invention; Figure 4 This is a diagram of the pruning effect of sub-adjacent angle compression provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.

[0019] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0020] In some embodiments of the present invention, a method for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology is provided, and the method prunes redundant vector data from the search process based on compression technology. Specifically, vectors that are unlikely to become query results are screened out based on compression technology, effectively reducing unnecessary calculations, which is similar to compressing and optimizing data during the search process, thereby significantly improving query efficiency. In particular, the pruning method based on the triangle inequality uses geometric relationships to mathematically exclude irrelevant vectors while maintaining high precision, reducing a large number of distance calculations, and is an efficient "compression" strategy suitable for high-dimensional vector retrieval.

[0021] Correspondingly, in some other embodiments of the present invention, a system, device and medium are provided for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology.

[0022] Example 1 like Figure 1 As shown, the present invention provides a method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology, which includes the following steps: 1) Pre-train the original data set and divide it into multiple data clusters, i.e., query sets; 2) Determine the query vector Q and the first K nearest neighbor vectors of the query vector Q according to the actual retrieval requirements; 3) Based on the triangle inequality pruning method, each data cluster is compressed and optimized using the first K nearest neighbor vectors of the query vector Q and the position of the data cluster; 4) Based on the compressed and optimized data cluster, the approximate nearest neighbor search results of the query vector Q are obtained.

[0023] Furthermore, in the above step 1), when pre-training the original data set, machine learning or deep learning methods are usually used to extract the feature representation of the data. The pre-trained data is divided into multiple data clusters through a clustering algorithm (such as K-means), and each cluster contains similar vectors in the feature space. These data clusters constitute the query set, which is helpful for subsequent efficient retrieval.

[0024] Furthermore, in the above step 2), during the retrieval process, the query vector Q may come from user input or other data sources. According to specific retrieval requirements, it is also necessary to find the first K nearest neighbor vectors of the query vector Q. Similarity is usually evaluated by distance metrics (such as Euclidean distance or cosine similarity) to ensure that the retrieval results meet expectations. The specific method of determining the nearest neighbor vector of the query vector Q is a well-known technology for those skilled in the art, and the present invention will not elaborate on this.

[0025] Furthermore, in the above step 3), in order to improve the retrieval efficiency, the present invention uses a pruning method based on the triangle inequality to optimize the query. By using the known distance between the query vector Q and the center of each data cluster, it is possible to quickly determine whether certain clusters and regions may contain the neighbors of Q, thereby reducing unnecessary calculations.

[0026] like Figure 2 to Figure 4 Specifically, the steps include: 3.1) Center distance compression: Use the distance between the query vector Q and the pre-calculated cluster center C to screen the vector data in each data cluster to obtain the first candidate vector set; 3.2) Sub-neighbor distance compression: The distance relationship between the query vector Q and some vectors in the first candidate vector set is used to screen the neighbors of the set to obtain the second candidate vector set; 3.3) Sub-neighboring angle compression: The third candidate vector set is obtained by screening the known K nearest neighbor vectors of the query vector Q and the angle relationship between the second candidate vector set area.

[0027] Furthermore, in the above step 3.1), if Figure 2 As shown, the following steps are included: 3.1.1) Calculate the distance D1 from the query vector Q to the cluster center C; 3.1.2) Compare the distance D1 with the preset threshold TopK, and screen the vector data in each data cluster according to the comparison result to obtain the first candidate vector set.

[0028] Specifically, the screening method is: If the distance D1 is greater than the preset threshold TopK, it is considered that the vectors in the data cluster whose distance from the cluster center C is between TopK-D1 cannot become the neighbors of the query vector Q. The vectors in the cluster that are closer to the cluster center C can be directly excluded because they cannot meet the TopK neighbor condition; if the distance D1 is less than the preset threshold TopK, all vectors in the data cluster are retained.

[0029] In this embodiment, through the step of center distance compression, possible neighbors can be screened out in the data cluster first, providing a more streamlined set of candidate vectors for the subsequent distance and angle compression steps. This method allows us to remove unnecessary calculations while retaining potential neighbors, thereby effectively reducing the number of vectors that need to be further calculated.

[0030] Furthermore, in the above step 3.2), if Figure 3 As shown, the following steps are included: 3.2.1) Calculate the distance D2 between the query vector Q and any vector P1 in the first candidate vector set; 3.2.2) Compare the distance D2 with the preset threshold TopK, and screen the vector data in the first candidate vector set according to the comparison result to obtain a second candidate vector set.

[0031] Specifically, if the distance between the query vector Q and any vector P1 in the first candidate vector set is greater than the current TopK threshold, then the vector P1 itself is considered not to be a neighbor of the query vector Q. At the same time, if the distance between vector P2 and vector P1 is relatively close (i.e., the distance between P2 and P1 is within D2-TopK), then vector P2 cannot meet the neighbor condition either, so vector P2 can be directly compressed. This is because the distance between P2 and the query vector Q will definitely not be less than TopK, thus eliminating the need for further calculation of P2.

[0032] In this embodiment, by using the sub-neighbor distance compression method, some impossible neighbor vectors can be quickly eliminated while retaining potential candidate neighbors, thereby effectively reducing the amount of calculation.

[0033] Furthermore, the above step 2.3) includes the following steps: 3.3.1) Calculate the angle between the query vector Q and each vector in the second candidate vector set; 3.3.2) Calculate the angle θ2 between the query vector Q and the TopK region to determine whether the vector is likely to enter the TopK region; 3.3.3) Compare the angles between each vector in the second candidate vector set and the query vector Q with θ2, and screen the vectors in the data cluster according to the comparison result to obtain the third candidate vector set.

[0034] like Figure 4 As shown in the figure, an example of sub-neighbor distance compression is shown, including the positional relationship between the query vector Q and the two vectors P1 and P2 in the cluster. The blue area is the prunable area. If the angle of a vector does not fall within this range, it means that it cannot meet the conditions to become a TopK neighbor, and then the vector can be directly eliminated. This step further compresses the search space because vectors that do not meet the angle conditions are irrelevant to the query results and can be safely ignored.

[0035] Through this sub-neighborhood angle compression method, we significantly reduce redundant calculations while maintaining high retrieval accuracy, making the final query process more efficient.

[0036] Example 2 This example verifies the performance of the present invention on multiple public datasets, including vector datasets of different data types and dimensions such as Fashion, Msong, SIFT1M, Glove25, etc. The pruning method of the present invention is compared with the existing state-of-the-art system Faiss, using the same clustering method and number of clusters to ensure a fair comparison.

[0037] Through experiments, it is found that the pruning modules of the present invention under different configurations (such as only center distance pruning, only sub-neighboring distance pruning, only sub-neighboring angle pruning and all pruning modules) can significantly improve query efficiency. In the trade-off between query accuracy and query speed (QPS), the present invention can achieve higher query speed while maintaining high retrieval quality by adjusting the pruning intensity.

[0038] Experimental results show that for different data sets, the pruning strategy of the present invention achieves a speedup of up to 10 times with very little sacrifice in accuracy. For example, on the NUSwide data set, after enabling all pruning modules, we observed a 10-fold query speedup compared to Faiss while maintaining accuracy. Compared to the traditional precision control method based on the number of clusters, the present invention achieves controllable optimization of result quality by adjusting the pruning intensity, thereby achieving higher performance under different quality requirements.

[0039] Example 3 The above-mentioned embodiment 1 provides a method for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology. Correspondingly, this embodiment provides a system for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology. The system provided in this embodiment can implement the method for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology in embodiment 1, and the system can be implemented by software, hardware, or a combination of software and hardware. For example, the system may include integrated or separate functional modules or functional units to execute the corresponding steps in each method of embodiment 1. Since the system of this embodiment is basically similar to the method embodiment, the process described in this embodiment is relatively simple, and the relevant parts can refer to the partial description of embodiment 1. The embodiment of the system provided in this embodiment is only schematic.

[0040] The system for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology provided in this embodiment includes: The data preprocessing module is used to pre-train the original data set and divide it into multiple data clusters, namely the query set; A query vector determination module is used to determine a query vector Q and the first K nearest neighbor vectors of the query vector Q according to actual retrieval requirements; A compression optimization module is used to compress and optimize each data cluster using the K nearest neighbor vectors of the query vector Q and the positions of the data clusters based on the pruning method of the triangle inequality; The result output module is used to obtain the approximate nearest neighbor search result of the query vector Q based on the compressed and optimized data cluster.

[0041] Example 4 This embodiment provides a processing device corresponding to the method for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology provided in this embodiment 1. The processing device can be a processing device for a client, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the method of embodiment 1.

[0042] The processing device includes a processor, a memory, a communication interface and a bus, and the processor, the memory and the communication interface are connected through the bus to complete mutual communication. The memory stores a computer program that can be run on the processor, and the processor executes the method for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology provided in this embodiment 1 when running the computer program.

[0043] Preferably, the memory may be a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory.

[0044] Preferably, the processor may be a central processing unit (CPU), a digital signal processor (DSP) or other general-purpose processors, which are not limited here.

[0045] Example 5 The method for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology in this embodiment 1 can be specifically implemented as a computer program product, which may include a computer-readable storage medium carrying computer-readable program instructions for executing the method for optimizing the approximate nearest neighbor search of high-dimensional vectors based on compression technology described in this embodiment 1.

[0046] Computer readable storage media can be tangible devices that hold and store instructions used by instruction execution devices. Computer readable storage media can be, for example, but not limited to, electronic storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any combination thereof.

[0047] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks. These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 One or more processes and / or boxes Figure 1 A function specified in one or more boxes. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology, characterized in that: The following steps are involved: Pre-train the original data set and divide it into multiple data clusters; Determine the query vector Q and the first K nearest neighbor vectors of the query vector Q according to the actual retrieval requirements; Based on the triangle inequality pruning method, the K nearest neighbor vectors of the query vector Q and the position of the data cluster are used to compress and optimize each data cluster. Based on the compressed and optimized data clusters, the approximate nearest neighbor search results of the query vector Q are obtained.

2. A method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 1, characterized in that: The triangle inequality-based pruning method uses the known neighborhood of the query vector Q and the location of the data cluster to compress and optimize each data cluster, including: The vector data in each data cluster is screened using the distance between the query vector Q and the pre-calculated cluster center C to obtain a first candidate vector set; Using the distance relationship between the query vector Q and some vectors in the first candidate vector set, the neighbors of the set are screened to obtain a second candidate vector set; The third candidate vector set is obtained by screening using the angular relationship between the K nearest neighbor vectors of the query vector Q and the second candidate vector set region.

3. A method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 2, characterized in that: The vector data in each data cluster is screened by using the distance between the query vector Q and the pre-calculated cluster center C to obtain a first candidate vector set, including: Calculate the distance D1 from the query vector Q to the cluster center C; The distance D1 is compared with a preset threshold value TopK, and the vector data in each data cluster is screened according to the comparison result to obtain a first candidate vector set.

4. The method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 3, characterized in that: The distance D1 is compared with a preset threshold value TopK, and the vector data in each data cluster is screened according to the comparison result, including: If the distance D1 is greater than the preset threshold TopK, it is considered that the vectors in the data cluster whose distance from the cluster center C is TopK-D1 cannot become the neighbors of the query vector Q. In this case, the vectors in the cluster that are closer to the cluster center C are directly excluded. If the distance D1 is less than the preset threshold TopK, all vectors in the data cluster are retained.

5. The method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 2, characterized in that: The method uses the distance relationship between the query vector Q and some vectors in the first candidate vector set to screen the neighbors of the set to obtain the second candidate vector set, including: Calculate the distance D2 between the query vector Q and any vector P1 in the first candidate vector set; The distance D2 is compared with a preset threshold value TopK, and the vector data in the first candidate vector set is screened according to the comparison result to obtain a second candidate vector set.

6. A method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 5, characterized in that: The step of comparing the distance D2 with a preset threshold value TopK and screening the vector data in the first candidate vector set according to the comparison result includes: If the distance between the query vector Q and any vector P1 in the first candidate vector set is greater than the current TopK threshold, then vector P1 itself is considered not to be a neighbor of the query vector Q and needs to be removed; at the same time, if the distance between vector P2 and vector P1 is within D2 -TopK, then vector P2 is removed.

7. The method for optimizing high-dimensional vector approximate nearest neighbor search based on compression technology as claimed in claim 2, characterized in that: The method uses the angle relationship between the known neighborhood of the query vector Q and the second candidate vector set area to perform screening to obtain a third candidate vector set, including: Calculate the angle between the query vector Q and each vector in the second candidate vector set; Calculate the angle θ2 between the query vector Q and the TopK region; The angles between each vector in the second candidate vector set and the query vector Q are compared with θ2, and the vectors in the cluster are screened according to the comparison result to obtain a third candidate vector set.

8. A system for optimizing approximate nearest neighbor search of high-dimensional vectors based on compression technology, characterized in that: include: The data preprocessing module is used to pre-train the original data set and divide it into multiple data clusters, namely the query set; A query vector determination module is used to determine a query vector Q and the first K nearest neighbor vectors of the query vector Q according to actual retrieval requirements; A compression optimization module is used to compress and optimize each data cluster using the K nearest neighbor vectors of the query vector Q and the positions of the data clusters based on the pruning method of the triangle inequality; The result output module is used to obtain the approximate nearest neighbor search result of the query vector Q based on the compressed and optimized data cluster.

9. A computer-readable storage medium storing one or more programs, characterized in that: The one or more programs include instructions, which, when executed by a computing device, cause the computing device to perform any one of the methods of claims 1 to 7.

10. A computing device, characterized in that: include: One or more processors and a memory, wherein the memory stores one or more programs and is configured to be executed by the one or more processors, wherein the one or more programs include instructions for executing any one of the methods described in claims 1 to 7.

Citation Information

Cited By

  • Vector database system based on graph structure and query optimization method

    CN120849664A