Vector search method and related apparatus
By combining primary and secondary quantized data, and integrating depth-first and breadth-first search, the vector retrieval path is optimized, solving the problem of decreased retrieval efficiency caused by the expansion of the vector database, and achieving efficient vector retrieval.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2025-06-05
- Publication Date
- 2026-06-04
AI Technical Summary
In existing technologies, as vector databases expand, the number of vectors that need to be calculated to determine the distance between the vector and the query vector during vector retrieval increases, leading to a decrease in retrieval efficiency.
Vector retrieval is performed by combining primary and secondary quantized data. The candidate set is updated by calculating the distance between the secondary quantized data and the query vector. After the candidate set is updated, the distance between the vector and the query vector is updated using primary quantized data. The retrieval path is optimized by combining depth-first and breadth-first search methods.
While ensuring the accuracy of vector retrieval, the efficiency of vector retrieval has been significantly improved. By optimizing the storage medium and quantization method, the computational overhead has been reduced and the retrieval speed has been increased.
Smart Images

Figure CN2025099317_04062026_PF_FP_ABST
Abstract
Description
A vector retrieval method and related apparatus
[0001] This application claims priority to Chinese Patent Application No. 202411750921.X, filed with the State Intellectual Property Office of China on November 30, 2024, entitled "A Vector Retrieval Method and Related Device", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of data processing technology, and in particular to a vector retrieval method and related apparatus. Background Technology
[0003] With the advent of the big data era, vector retrieval has gradually become a key technology in big data processing. Vector retrieval refers to retrieving one or more vectors that are most similar to the query vector (i.e., have the smallest vector distance) from a vector database containing a large number of vectors, based on the query vector input by the user.
[0004] Currently, the combination of vector databases and large language models is one of the mainstream research directions in large language models. Generally, vector databases are used to store vectors pre-extracted for various types of data (such as text, audio, images, or video). When a large language model needs to generate text or answer questions, it can retrieve vectors similar to the query vector input to the large language model by searching for similar vectors in the vector database. These retrieved vectors can then guide the large language model in generating text or answering questions, thereby improving the accuracy of the large language model's output.
[0005] As vector databases continue to expand, the number of vectors requiring distance calculations between the retrieved and query vectors also increases, impacting the efficiency of vector retrieval. Therefore, improving the efficiency of vector retrieval has become a pressing issue. Summary of the Invention
[0006] This application provides a vector retrieval method and related apparatus, which improves the efficiency of vector retrieval while ensuring the accuracy of vector retrieval.
[0007] Firstly, a vector retrieval method is provided to improve the efficiency of vector retrieval. This method includes: firstly, obtaining a query vector and a first vector connection graph, where the first vector connection graph records the connection relationships between vector indices, wherein the distance between the vectors corresponding to two connected vector indices satisfies a preset condition. Generally, the vectors corresponding to two connected vector indices are usually close to each other. Vectors that are far apart will not have a connection relationship.
[0008] Then, during vector retrieval based on the first vector connectivity graph, the candidate set is updated by calculating the distance between the second-level quantized data and the query vector. The candidate set records the multiple vectors retrieved that are closest to the query vector, and it is used to generate the vector retrieval results after the retrieval is complete. That is, the candidate set always indicates the multiple vectors retrieved by the execution device that are closest to the query vector. Furthermore, the distance between the vectors in the candidate set and the query vector is calculated based on the first-level quantized data.
[0009] The first-level quantized data is obtained by quantizing the vectors in the vector set using the first quantization method, and the second-level quantized data is obtained by quantizing the vectors in the vector set using the second quantization method. The data compression degree of the second quantization method is greater than that of the first quantization method.
[0010] In this scheme, during vector retrieval based on a vector connectivity graph, the distance between the second-order quantized data of a vector and the query vector is calculated to determine whether the vector needs to be added to the candidate set. After the candidate set is updated, the distance between the vectors in the candidate set and the query vector is updated to the distance between the vector's first-order quantized data and the query vector. Since both first-order and second-order quantized data are obtained by quantizing the original vector data, and the second-order quantized data has a higher degree of data compression than the first-order quantized data, using second-order quantized data to calculate the distance between vectors during vector traversal in the vector connectivity graph effectively improves computational efficiency. Furthermore, using first-order quantized data to update the distance between vectors after the candidate set is updated ensures that the screened vectors maintain a high-precision distance within the candidate set. This ensures that each time the candidate set is updated, the vector with the largest distance to the query vector in the candidate set is replaced, thus guaranteeing the accuracy of vector retrieval and improving its efficiency.
[0011] In one possible implementation, the first-level quantized data corresponding to the vectors indicated by the first vector connection graph is stored in a first storage medium, and the second-level quantized data corresponding to the vectors indicated by the first vector connection graph is stored in a second storage medium. The read / write speed of the second storage medium is higher than that of the first storage medium. Furthermore, the capacity of the second storage medium is typically smaller than that of the first storage medium.
[0012] Since the amount of secondary quantization data is relatively small and it is frequently used (i.e., used to perform vector distance calculations), this solution stores the secondary quantization data in a storage medium with high read / write speed but small capacity, while storing the primary quantization data, which has a larger amount of data, in a storage medium with low read / write speed but large capacity, in order to improve the efficiency of vector retrieval.
[0013] In one possible implementation, the first storage medium is a persistent storage medium, and the second storage medium is memory.
[0014] In one possible implementation, the degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
[0015] In this scheme, the data compression level of the second quantization method is determined based on the data volume of the vector indicated by the first vector connection graph and the capacity of the second storage medium. This allows the second-level quantized data of the vector to be stored in the second storage medium with higher read and write speeds as much as possible, thereby ensuring the efficiency of vector retrieval.
[0016] In one possible implementation, the degree of data compression in the first quantization method is determined based on the accuracy requirements of vector retrieval.
[0017] In this scheme, the data compression level of the first quantization method is determined based on the accuracy requirements of vector retrieval. This approach can balance the efficiency and accuracy requirements of vector retrieval while ensuring the accuracy of vector retrieval as much as possible.
[0018] In one possible implementation, the execution device first determines the retrieval entry point of the first vector connection graph. The retrieval entry point is a vector in the first vector connection graph, and it is used to indicate the starting point of the vector retrieval. Thus, when performing a vector retrieval, the execution device performs the vector retrieval in the first vector connection graph with the retrieval entry point as the starting point.
[0019] In one possible implementation, when determining the retrieval entry point of the first vector connection graph, the execution device first obtains a second vector connection graph, which is used to record the connection relationships between some vectors in the vector set.
[0020] Then, based on the query vector, the execution device performs vector retrieval in the second vector connection graph to obtain the retrieval results of the second vector connection graph, which are used as the retrieval entry point.
[0021] In this scheme, by first performing vector retrieval in the second vector connection graph with a smaller number of vectors, the approximate location of the vector closest to the query vector can be quickly determined. Then, based on the location retrieved from the second vector connection graph, vector retrieval is further performed in the first vector connection graph. This helps to shorten the retrieval path in the first vector connection graph with a larger number of vectors and improves the overall efficiency of vector retrieval.
[0022] In one possible implementation, during the vector retrieval process in the second vector connection graph, the execution device first performs a vector retrieval in the second vector connection graph based on a depth-first search to obtain the target vector; then, the execution device uses the neighbor vectors of the target vector in the second vector connection graph as the starting point for retrieval and performs a vector retrieval in the second vector connection graph based on a breadth-first search to obtain the retrieval result.
[0023] In this scheme, the retrieval is first performed based on depth-first search and then based on breadth-first search. This approach can quickly approximate the nearest neighbor of the query vector before expanding the retrieval scope by diverging and extending the search, thus avoiding getting trapped in local optima, improving the accuracy of vector retrieval, and ultimately ensuring that vector retrieval can be completed at a high speed.
[0024] In one possible implementation, after the vector retrieval performed based on the first vector connectivity graph is completed, the execution device obtains vectors from the candidate set. Furthermore, by calculating the distance between the vectors in the candidate set and the query vector, the execution device determines the vector retrieval result, which indicates one or more vectors recorded in the candidate set. For example, the vector retrieval result may indicate the corresponding vector by recording one or more vector indices; or, the vector retrieval result may include one or more vectors.
[0025] In this scheme, the distance between the original vector data and the query vector is recalculated to obtain the accurate distance between each vector in the candidate set and the query vector. Based on the candidate set, accurate vector retrieval results are obtained, ensuring the accuracy of vector retrieval.
[0026] In one possible implementation, to improve the efficiency of constructing the vector connectivity graph, the first vector connectivity graph is constructed by calculating the distance between vectors in the vector set based on first-level quantized data.
[0027] In one possible implementation, after the candidate set is updated, the execution device calculates the distance between the vectors in the candidate set and the query vector based on the first-level quantization data, thereby updating the distances corresponding to the vectors in the candidate set to the distances between the first-level quantization data of the vectors and the query vector. That is, the distances between the vectors in the candidate set and the query vector are calculated based on the first-level quantization data of the vectors, thus ensuring the accuracy of the vector distances indicated by the candidate set.
[0028] Secondly, a vector retrieval device is provided, comprising: an acquisition module for acquiring a query vector and a first vector connection graph, the first vector connection graph being used to record the connection relationships between vectors in a vector set; and a processing module for updating a candidate set by calculating the distance between secondary quantized data and the query vector during the vector retrieval process based on the first vector connection graph, the candidate set being used to record multiple vectors retrieved that are closest to the query vector, and the candidate set being used to generate vector retrieval results after the vector retrieval is completed, wherein the distance between the vectors in the candidate set and the query vector is calculated based on primary quantized data; wherein the primary quantized data is obtained by quantizing the vectors in the vector set using a first quantization method, and the secondary quantized data is obtained by quantizing the vectors in the vector set using a second quantization method, and the data compression degree of the second quantization method is greater than that of the first quantization method.
[0029] In one possible implementation, primary quantization data is stored in a first storage medium, and secondary quantization data is stored in a second storage medium, with the second storage medium having a higher read / write speed than the first storage medium.
[0030] In one possible implementation, the first storage medium is a persistent storage medium, and the second storage medium is memory.
[0031] In one possible implementation, the degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
[0032] In one possible implementation, the degree of data compression in the first quantization method is determined based on the accuracy requirements of vector retrieval.
[0033] In one possible implementation, the processing module is further configured to: determine a retrieval entry point of the first vector connection graph, wherein the retrieval entry point is a vector in the first vector connection graph, and the retrieval entry point is used to indicate the starting point of vector retrieval.
[0034] In one possible implementation, the acquisition module is further configured to acquire a second vector connection graph, which records the connection relationships between some vectors in the vector set; the processing module is further configured to perform vector retrieval based on the query vector in the second vector connection graph to obtain the retrieval results of the second vector connection graph, which are used as retrieval entry points.
[0035] In one possible implementation, the processing module is further configured to: perform vector retrieval in the second vector connection graph based on a depth-first search to obtain the target vector; and perform vector retrieval in the second vector connection graph based on a breadth-first search, using the neighbor vectors of the target vector in the second vector connection graph as the starting point, to obtain the retrieval result.
[0036] In one possible implementation, after the vector retrieval performed based on the first vector connection graph is completed, the acquisition module is further configured to acquire vectors in the candidate set; the processing module is further configured to determine the vector retrieval result by calculating the distance between the vectors in the candidate set and the query vector, and the vector retrieval result is used to indicate one or more vectors recorded in the candidate set.
[0037] In one possible implementation, the first vector connectivity graph is constructed by calculating the distances between vectors in the vector set based on first-level quantized data.
[0038] In one possible implementation, the processing module is also used to calculate the distance between the vectors in the candidate set and the query vector based on the first-level quantized data after the candidate set is updated.
[0039] Thirdly, a vector retrieval device is provided, comprising: a processor and a memory; the memory is used to store computer instructions, which, when executed by the processor, cause the vector retrieval device to perform the method described in any of the above aspects.
[0040] Fourthly, a computer-readable storage medium is provided that stores instructions which, when executed on a computer, cause the computer to perform the methods of any of the above aspects.
[0041] Fifthly, a computer program product containing instructions is provided, which, when executed on a computer, enable the computer to perform the methods described above.
[0042] In a sixth aspect, a chip system is provided, the chip system including a processor and a communication interface for communicating with a module other than the chip shown, the processor for running computer programs or instructions such that an apparatus on which the chip system is mounted can perform the methods of any of the above aspects.
[0043] In a seventh aspect, a computing device is provided, which includes a vector retrieval device of the third aspect or a chip system of the sixth aspect, wherein the vector retrieval device or the chip system in the computing device is used to implement the operational steps of the method of any of the above aspects.
[0044] Eighthly, a computing device cluster is provided, comprising at least one computing device, wherein any one computing device is used to run a computer program or instructions, such that the computing device cluster can perform the methods of any of the above aspects. Alternatively, some or all of the computing devices are used together to run a computer program or instructions, such that the computing device cluster can perform the methods of any of the above aspects.
[0045] Based on the implementation methods provided in the above aspects, this application can be further combined to provide more implementation methods. Attached Figure Description
[0046] Figure 1 is a schematic diagram of a vector retrieval method provided in this application;
[0047] Figure 2 is a schematic diagram of a system architecture provided in this application;
[0048] Figure 3 is a flowchart illustrating a vector retrieval method provided in this application;
[0049] Figure 4 is a schematic diagram of the structure of a first vector connection graph provided in this application;
[0050] Figure 5 is a schematic diagram of an update of a candidate set provided in this application;
[0051] Figure 6 is a comparative diagram of a search path provided in this application;
[0052] Figure 7 is a flowchart illustrating a graph construction process provided in this application;
[0053] Figure 8 is a flowchart illustrating a vector retrieval process provided in this application;
[0054] Figure 9 is a schematic diagram of the structure of a vector retrieval device provided in this application;
[0055] Figure 10 is a schematic diagram of the structure of a computing device provided in this application;
[0056] Figure 11 is a schematic diagram of the structure of a computing device cluster provided in this application;
[0057] Figure 12 is a schematic diagram of another computing device cluster provided in this application;
[0058] Figure 13 is a schematic diagram of the structure of a computer-readable storage medium provided in this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application are described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, and not all, of the embodiments of this application. Those skilled in the art will recognize that, with the emergence of new application scenarios, the technical solutions provided by this application are also applicable to similar technical problems.
[0060] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such descriptions can be used interchangeably where appropriate to allow embodiments to be implemented in a sequence other than that illustrated or described in this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products, or devices. The naming or numbering of steps appearing in this application does not imply that the steps in the method flow must be performed in the chronological / logical order indicated by the naming or numbering. The execution order of named or numbered process steps can be changed according to the desired technical purpose, as long as the same or similar technical effect is achieved. The division of units in this application is a logical division. In practical applications, there may be other division methods. For example, multiple units may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the shown or discussed mutual coupling, direct coupling, or communication connection may be through some interface, and the indirect coupling or communication connection between units may be electrical or other similar forms, none of which are limited in this application. Furthermore, the units or sub-units described as separate components may or may not be physically separated, may or may not be physical units, or may be distributed among multiple circuit units. Some or all of the units can be selected to achieve the purpose of the solution in this application according to actual needs.
[0061] To facilitate understanding, some technical terms used in this application will be introduced below.
[0062] (1) Large Language Model (LLM)
[0063] Large language models are deep learning models trained on massive amounts of text data that can generate natural language text or understand the meaning of language text. Large language models can handle various natural language tasks, such as text classification, question answering, and dialogue, and are an important pathway to artificial intelligence.
[0064] Specifically, large language models are a technology that has emerged in recent years. Because large language models undergo meticulous data engineering and training processes, their parameters have learned a wealth of existing natural language processing knowledge. This knowledge can now replace humans in many language-related tasks, such as having large language models write code or perform text summarization.
[0065] (2) Vector Database
[0066] Vector databases are databases specifically designed for storing and retrieving vectors. The vectors they store are derived from the vectorization of text, speech, images, videos, and more. Compared to traditional databases, vector databases can handle more unstructured data (such as images and audio). In machine learning and deep learning, data is often represented in vector form.
[0067] (3) Vector quantization
[0068] Vector quantization is essentially a data compression process that transforms large amounts of raw vector data into smaller, quantized data. Compared to the original vector data, the quantized data obtained through vector quantization is smaller in size but also has lower precision.
[0069] (4) Data compression level
[0070] Data compression refers to the degree to which data is compressed. For the same data, the greater the degree of data compression, the smaller the size of the compressed data; conversely, the smaller the degree of data compression, the closer the size of the compressed data is to the size of the original data.
[0071] (5) Depth-First Search (DFS)
[0072] Depth-first search (DFS) is a type of graph algorithm. DFS works by searching along a branch path in the graph until the branch path reaches its maximum depth.
[0073] (6) Breadth First Search (BFS)
[0074] Breadth-first search (BFS) is also a type of graph algorithm. The working principle of BFS is to start from the initial vertex and search sequentially from nearest to farthest until the target vertex is found.
[0075] Please refer to Figure 1, which is a schematic diagram of a vector retrieval method provided in this application. As shown in Figure 1, vector retrieval refers to retrieving the K vectors (where K is an integer greater than or equal to 1) that are most similar to the query vector (i.e., have the smallest vector distance) from a vector database containing a large number of vectors, based on the query vector input by the user. Generally, vector retrieval can be applied to most scenarios to meet user needs in various scenarios. For example, in a product search scenario, by using vectors to represent each product and performing vector retrieval in a vector database, it is possible to retrieve the corresponding product for the product image or product description text input by the user. As another example, in a face recognition scenario, by using vectors to represent the faces of different users, and since the vector database stores a large number of vectors corresponding to images or videos, performing vector retrieval in the vector database can retrieve the corresponding image or video for the face information input by the user. For example, in the context of large language models, when a large language model needs to generate text or answer questions, it can retrieve vectors similar to the query vectors input to the large language model from a vector database by searching for similar vectors. Then, it can use the text or images corresponding to the retrieved vectors to guide the large language model in generating text or answering questions, thereby improving the accuracy of the output of the large language model.
[0076] In summary, the vector retrieval method provided in this application can be applied to vector retrieval processes in various scenarios, and this application does not impose any specific limitations on it.
[0077] The applicant's research revealed that current vector retrieval processes are typically based on vector connection graphs. These graphs record the connections between vectors, with connected vectors usually being close to each other. For a given query vector, by calculating the distance between the query vector and the vectors indicated in the vector connection graph, and searching along the connections indicated by the graph, one or more vectors closest to the query vector can be quickly found, thus completing the vector retrieval.
[0078] However, currently, the calculation of the distance between the query vector and the vector indicated in the vector connection graph is performed based on the original data of the vector. Since the original data of the vector is large, the vector retrieval process will generate a large computational overhead, resulting in low efficiency of vector retrieval.
[0079] In view of this, this application provides a vector retrieval method. During vector retrieval based on a vector connectivity graph, the distance between the second-order quantized data of a vector and the query vector is calculated to determine whether the vector needs to be added to the candidate set. After the candidate set is updated, the distance between the vectors in the candidate set and the query vector is updated to the distance between the vector's first-order quantized data and the query vector. Since both first-order and second-order quantized data are obtained by quantizing the original vector data, and the second-order quantized data has a higher degree of data compression than the first-order quantized data, using second-order quantized data to calculate the distance between vectors during vector traversal of the vector connectivity graph can effectively improve computational efficiency. Furthermore, using first-order quantized data to update the distance between vectors after the candidate set is updated ensures that the screened vectors maintain a high-precision distance in the candidate set. This ensures that each time the candidate set is updated, the vector with the largest distance to the query vector in the candidate set is replaced, thereby guaranteeing the accuracy of vector retrieval and improving the efficiency of vector retrieval while maintaining accuracy.
[0080] Please refer to Figure 2, which is a schematic diagram of a system architecture provided in this application. As shown in Figure 2, in this system architecture, the execution device 20 for performing the vector retrieval method provided in this application can be implemented by a single physical host (computing device) or multiple physical hosts (computing device cluster). The execution device 20 includes a second storage medium 201, which is a storage medium with relatively high read speed, such as memory. Optionally, the second storage medium 201 is used to store the secondary quantization data of the vector.
[0081] In addition, the system architecture also includes a first storage medium 21, which is used to persistently store vectors, first-level quantized data of the vectors, and second-level quantized data of the vectors in the vector database. Optionally, the first storage medium 21 may also store the original data corresponding to each vector, such as text data, audio data, image data, or video data. That is, the vectors stored in the first storage medium 21 are obtained by performing feature extraction on the original data.
[0082] Optionally, for persistent data storage, the first storage medium 21 can be located external to the execution device 20 and exchange data with the execution device 20 via a network. Alternatively, if the execution device 20 is a physical host, the first storage medium 21 can also be located internally to the execution device 20, such as exchanging data with the processor via a bus. In this case, the first storage medium 21 functions as a hard disk. With the first storage medium 21, the execution device 20 can read vectors from the first storage medium 21, thereby achieving vector retrieval.
[0083] Optionally, the execution device 20 may be connected to a data processing device 22. This data processing device 22 may be, for example, a model processing device running a neural network model. In this way, when the data processing device 22 needs to run the neural network model, it first obtains a query vector based on user-provided data and sends the query vector to the execution device 20. The execution device 20 then performs the vector retrieval based on the obtained query vector, thereby retrieving corresponding similar vectors for the query vector. The data processing device 22 may also be a user device, used to provide query data to the execution device 20 so that the execution device 20 can convert the query data into query vectors.
[0084] Please refer to Figure 3, which is a flowchart illustrating a vector retrieval method provided in this application. As shown in Figure 3, the vector retrieval method includes the following steps 301-303.
[0085] Step 301: Obtain the query vector and the first vector connection graph. The first vector connection graph is used to record the connection relationships between vectors in the vector set.
[0086] In vector databases, because vectors are inherently high-dimensional data, if the execution device calculates the distance between the query vector and all vectors in the vector database when performing vector retrieval, the computational load would be enormous, resulting in very low retrieval efficiency. Therefore, to improve the efficiency of vector retrieval, execution devices often use vector connectivity graphs to perform vector retrieval.
[0087] In this application, the query vector is the vector data to be queried input by the user. Typically, the query vector can be a feature vector of data such as images, audio, or text. The first vector connection graph is a vector connection graph constructed based on multiple vectors in the vector database. Specifically, since each vector in the vector database has a unique corresponding vector index, the first vector connection graph represents vectors using vector indices and represents the connection relationships between vectors by recording the connection relationships between vector indices.
[0088] For example, please refer to Figure 4, which is a schematic diagram of the structure of a first vector connection graph provided in this application. As shown in Figure 4, in the first vector connection graph, vectors are represented in the form of nodes (such as nodes 0-9 in Figure 4). Furthermore, if the distance between vectors is relatively short, these vectors can be connected by edges, thus establishing a connection relationship between the closely spaced vectors. For example, nodes 0 are connected to nodes 1-5 by edges, therefore, nodes 0 and nodes 1-5 are connected. During vector retrieval, the retrieval begins with certain vectors in the first vector connection graph, and the retrieval gradually follows the connection relationships of the vectors to retrieve other vectors, continuously adjusting the retrieval direction until the vector most similar to the query vector is found. For example, in Figure 4, when performing vector retrieval, the retrieval starts from node 0, first determining nodes 1-5 that are connected to node 0, and then calculating the distance between each vector represented by nodes 1-5 and the query vector. When it is found that the vector represented by node 1 is the closest to the query vector among the vectors represented by nodes 1-5, the nodes 6 and 9 that are connected to node 1 are identified, and the distance between each vector represented by node 6 and node 9 and the query vector is calculated in order to determine the next retrieval direction.
[0089] Generally, in the first vector connection graph, to ensure the efficiency of vector retrieval, only two vectors that are relatively close are usually assigned a connection relationship. That is, two vectors with a connection relationship are usually vectors that are close to each other. Vectors that are far apart will not have a connection relationship. In this application, the distance between two vectors with a connection relationship meets a preset condition, such as the distance between the two vectors being less than or equal to a preset threshold, or one of the two vectors being one of the N (N is an integer greater than 1) vectors closest to the other vector. In general, the preset conditions are often related to the construction method of the first vector connection graph, and this application does not specifically limit the preset conditions.
[0090] Step 302: During the vector retrieval process based on the first vector connection graph, the candidate set is updated by calculating the distance between the secondary quantized data and the query vector. The candidate set is used to record the multiple vectors that are closest to the query vector and is used to generate the vector retrieval results after the vector retrieval is completed.
[0091] It should be noted that during vector retrieval based on the first vector connection graph, the execution device maintains a candidate set. This candidate set records a fixed number of vectors, indicating which vectors are added to the candidate set. When the execution device performs vector retrieval along the connections recorded in the first vector connection graph, it records the distance between the retrieved vector and the query vector and determines whether to update the vectors in the candidate set based on the calculated distance. That is, the candidate set always indicates the vectors that the execution device has retrieved that are closest to the query vector (not necessarily the vectors that are actually closest to the query vector in the first vector connection graph). When the number of vectors added to the candidate set reaches a preset fixed number, the execution device replaces the vector in the candidate set that is farthest from the query vector with the newly retrieved vector, thus ensuring that the candidate set always indicates the currently retrieved vector that is closest to the query vector.
[0092] In this application, to reduce the overhead of calculating vector distances during the traversal of the first vector connectivity graph, the execution device does not calculate the distance between the query vector and the original vector data, but rather the distance between the query vector and its corresponding second-order quantized data. Here, the original vector data refers to the original data of the vectors stored in the vector database, while the second-order quantized data is the data obtained after quantizing the original vector data. Compared to the original vector data, the second-order quantized data has a smaller data volume, but its precision is reduced. It should be noted that when performing distance calculations based on the second-order quantized data, the execution device also needs to perform a quantization process on the query vector to obtain the second-order quantized data corresponding to the query vector, and then calculate the distance between the second-order quantized data corresponding to the query vector and the second-order quantized data corresponding to the vector index.
[0093] Although the precision of secondary quantization data decreases, the essence of vector retrieval is to filter vectors (i.e., to select the multiple vectors closest to the query vector). Therefore, calculating the distance between vectors based on secondary quantization data does not significantly affect the precision of vector retrieval. Specifically, the process of filtering vectors is essentially finding the multiple vectors closest to the query vector by comparing the distances between them, much like the process of sorting numbers. Compared to the distance calculated based on the original vector data, the precision of the distance calculated based on secondary quantization data will decrease. For example, the distance calculated based on the original vector data is represented by M digits, while the distance calculated based on secondary quantization data is represented by MN digits, where M is an integer greater than 1 and N is an integer greater than or equal to 1. That is, compared to the distance calculated based on the original vector data, the distance calculated based on secondary quantization data may only have some of the higher-order digits, lacking the lower-order digits. In this case, filtering vectors by comparing the distances calculated based on secondary quantization data can still effectively filter the vast majority of vectors. However, for vectors whose distances are very close to the query vector, calculating the distance based on secondary quantization data may not be able to determine the relative distances between these vectors and the query vector.
[0094] In summary, this application updates the candidate set by calculating the distance between the secondary quantized data with a smaller data volume and the query vector, thereby ensuring that the candidate set always indicates the multiple vectors that have been retrieved and are closest to the query vector.
[0095] Step 303: After the candidate set is updated, calculate the distance between the vector in the candidate set and the query vector based on the first-level quantized data.
[0096] In this application, the first-level quantized data is obtained by quantizing the original vector data corresponding to the vector index using a first quantization method, and the second-level quantized data is obtained by quantizing the original vector data corresponding to the vector index using a second quantization method. Furthermore, the data compression level of the second quantization method is greater than that of the first quantization method. That is, for the same vector, the amount of data in the second-level quantized data is less than the amount of data in the first-level quantized data, and the precision of the second-level quantized data is lower than that of the first-level quantized data.
[0097] Optionally, the first and second quantization methods can be different types of quantization. For example, the first quantization method could be scalar quantization (SQ), and the second quantization method could be product quantization. Scalar quantization converts a floating-point number (e.g., a 32-bit floating-point number) into a smaller number (e.g., an 8-bit unsigned integer). Product quantization is a technique for compressing high-dimensional vectors. It works by dividing the original vector into multiple sub-vectors, quantizing each sub-vector independently, and assigning it to the nearest cluster centroid (called a copy value). The quantized vector is then represented using the IDs of these centroids.
[0098] Of course, the first quantization method and the second quantization method can be the same type of quantization method, but they differ in the degree of data compression they apply. In general, this application does not limit the specific types of the first and second quantization methods.
[0099] During vector retrieval, after the execution device finds a vector closer to the query vector, it adds that vector to the candidate set and removes the vector furthest from the candidate set, thus updating the candidate set. However, determining whether a vector can be added to the candidate set is based on calculating the distance between vectors using secondary quantization data. Since the precision of distances calculated using secondary quantization data is relatively low, when multiple vectors close to the query vector are added to the candidate set, the relative magnitudes of their secondary quantization data and their distances to the query vector may be difficult to determine effectively.
[0100] Therefore, to ensure the accuracy of candidate set updates (i.e., ensuring that the vector furthest from the query vector is always removed from the candidate set), this step updates the distances between vectors in the candidate set to the distances between the vector's first-level quantized data and the query vector. In other words, the distances between vectors in the candidate set and the query vector are calculated based on the vector's first-level quantized data, thus ensuring the accuracy of the vector distances indicated by the candidate set. This facilitates precise sorting of vectors in the candidate set based on accurate vector distances. It should be noted that when performing distance calculations based on first-level quantized data, the execution device also needs to perform a quantization process on the query vector to obtain the first-level quantized data corresponding to the query vector, and then calculate the distance between the first-level quantized data corresponding to the query vector and the first-level quantized data corresponding to the vector.
[0101] It should be noted that after the candidate set is updated, the execution device may not update the distances between the vectors in the candidate set and the query vector in real time. Therefore, the distances between some vectors in the candidate set and the query vector may be calculated based on second-level quantization data, while the distances between other vectors and the query vector may be calculated based on first-level quantization data. That is, at a certain point in time after the candidate set is updated, not all vectors in the candidate set may have distances between them and the query vector calculated based on first-level quantization data.
[0102] For example, please refer to Figure 5, which is a schematic diagram of updating a candidate set provided in this application. As shown in Figure 5, when the decision to update the candidate set is based on the distance calculated from the secondary quantization data, and the candidate set records the distance between the secondary quantization data and the query vector, assuming that the vectors already added to the candidate set include vectors 1-5, and the distances between vectors 1-5 and the query vector calculated based on the secondary quantization data of vectors 1-5 are 3, 5, 8, 10, and 10, respectively. Then, when a new vector 6 is retrieved, and the distance between vector 6 and the query vector is calculated to be 5 based on the secondary quantization data of vector 6, the execution device confirms that vector 6 is added to vector 2 in the candidate set, and removes vector 5 from the candidate set.
[0103] When deciding whether to update the candidate set based on the distance calculated from the secondary quantization data, and assuming the candidate set records the distance between the primary quantization data and the query vector, for vectors 1-5 already added to the candidate set, the distances between vectors 1-5 and the query vector calculated from their primary quantization data are 3.12, 5.33, 8.42, 10.44, and 10.02, respectively. Clearly, with higher distances, it can be confirmed that the distance between vector 4 and the query vector is actually greater than the distance between vector 5 and the query vector. Therefore, when a new vector 6 is retrieved, and the distance between vector 6 and the query vector is calculated to be 5 based on its secondary quantization data, the execution device confirms adding vector 6 to vector 1 in the candidate set and removes vector 4 from the candidate set.
[0104] Clearly, updating the vector distances indicated in the candidate set to distances calculated based on first-level quantization data yields more accurate vector distances, which facilitates accurate sorting of vectors in the candidate set, so that the vector furthest from the query vector can be precisely removed each time the candidate set is updated.
[0105] It should be noted that steps 302-303 above describe updating the candidate set and the distances between vectors in the candidate set during the vector retrieval process. In practical applications, the execution device needs to continuously perform vector retrieval along the connection relationships of the first vector connection graph, and determine whether to update the candidate set by calculating the distance between the retrieved vector and the query vector. Thus, after the execution device completes the retrieval of the first vector connection graph, it can generate vector retrieval results based on the final candidate set, thereby returning the corresponding vector retrieval results to the user.
[0106] In summary, since both primary and secondary quantized data are obtained by quantizing the original vector data, and secondary quantized data has a higher degree of data compression than primary quantized data, using secondary quantized data to calculate the distance between vectors during vector traversal in the vector connectivity graph can effectively improve computational efficiency. Furthermore, using primary quantized data to update the distance between vectors after the candidate set is updated ensures that the screened vectors maintain a high-precision distance within the candidate set. This ensures that each update of the candidate set replaces the vector with the largest distance to the query vector, thus guaranteeing the accuracy of vector retrieval and improving efficiency while maintaining accuracy. Moreover, distance calculations based on primary quantized data are only performed after the candidate set is updated. Therefore, the number of times distances are calculated based on secondary quantized data is usually far greater than the number of times distances are calculated based on primary quantized data throughout the entire vector retrieval process, ensuring high efficiency.
[0107] Optionally, to improve the construction efficiency of the vector connectivity graph, the first vector connectivity graph is constructed by calculating the distance between vectors in the vector set based on first-level quantized data. That is, the first vector connectivity graph is essentially constructed based on the distance between vectors, while in this application, the distance between the first-level quantized data of vectors is calculated instead of the distance between the original data of vectors, thereby simplifying the vector distance calculation process, reducing the computational overhead of constructing the vector connectivity graph, and improving the construction efficiency of the vector connectivity graph.
[0108] Of course, in applications requiring high precision, the first vector connection graph can also be constructed by calculating the distance between the original vector data, and this application does not impose any specific limitations on this.
[0109] The above describes the first-level and second-level quantized data of vectors required in the vector retrieval process. The following will introduce how to implement the storage of the first-level and second-level quantized data.
[0110] Optionally, to further improve the efficiency of vector retrieval, the first-level quantized data corresponding to the vectors indicated by the first vector connection graph is stored in a first storage medium, and the second-level quantized data corresponding to the vectors indicated by the first vector connection graph is stored in a second storage medium. The read / write speed of the second storage medium is higher than that of the first storage medium. Furthermore, the capacity of the second storage medium is typically smaller than that of the first storage medium.
[0111] Generally, execution devices use multiple tiers of different storage media to store data to meet data storage and usage needs. Since storage media with higher read / write speeds are often more expensive, in a multi-tiered storage system, the capacity of the storage media with higher read / write speeds is usually smaller than the capacity of the storage media with lower read / write speeds.
[0112] In this application, since the amount of secondary quantization data is small and the secondary quantization data needs to be used frequently (i.e. used to perform vector distance calculation), the secondary quantization data is stored in a storage medium with high read / write speed but small capacity, while the primary quantization data with a larger amount of data is stored in a storage medium with low read / write speed but large capacity, so as to improve the efficiency of vector retrieval.
[0113] For example, the first storage medium is a persistent storage medium (such as a hard disk), and the second storage medium is memory. Of course, the first and second storage media can also be other storage media, such as the first storage medium having a read / write speed between memory and a hard disk; this application does not specifically limit this. In some scenarios, the first storage medium may also be a remote storage medium, meaning the execution device needs to access the remote first storage medium via a network to obtain the first-level quantized data.
[0114] Optionally, the degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
[0115] Specifically, the execution device may determine the second quantization method with the goal of storing the secondary quantized data corresponding to all vectors indicated by the first vector connection diagram in the second storage medium. Since quantization needs to be performed on all vectors indicated in the first vector connection diagram to obtain the corresponding secondary quantized data, the appropriate data compression level for the second quantization method can be determined based on the capacity of the second storage medium and the total data volume of all vectors indicated by the first vector connection diagram, so that all the quantized secondary quantized data can be stored in the second storage medium. Generally, the larger the capacity of the second storage medium, the lower the data compression level of the second quantization method can be set; the larger the data volume of the vectors indicated by the first vector connection diagram, the higher the data compression level of the second quantization method usually needs to be set.
[0116] Of course, in practical applications, the objective of the execution device in determining the second quantization method can also be to store a specified amount of secondary quantization data (such as 50% or 80% of the secondary quantization data) in the second storage medium, and this application does not specifically limit this.
[0117] In summary, this scheme determines the data compression level of the second quantization method based on the data volume of the vectors indicated by the first vector connection graph and the capacity of the second storage medium. This ensures that the second-level quantized data of the vectors can be stored in the second storage medium with higher read and write speeds, thereby ensuring the efficiency of vector retrieval.
[0118] Optionally, the data compression level of the first quantization method can be determined based on the accuracy requirements of vector retrieval. Since the first-level quantized data obtained based on the first quantization method is stored in a first storage medium with a large capacity, and the first-level quantized data is mainly used to ensure the accuracy of vector retrieval, the execution device can determine the data compression level of the first quantization method based on the accuracy requirements of the actual application.
[0119] Generally speaking, the higher the accuracy requirement of vector retrieval, the higher the accuracy requirement of the first-level quantization data, and the lower the data compression degree of the first quantization method. That is, the amount of first-level quantization data obtained based on the first quantization method is closer to the amount of original vector data.
[0120] In this scheme, the data compression level of the first quantization method is determined based on the accuracy requirements of vector retrieval. This approach can ensure the accuracy of vector retrieval as much as possible while taking into account the efficiency and accuracy requirements of vector retrieval.
[0121] In addition to the distance calculation process described above, the starting position of the retrieval in the first vector connection graph also affects the efficiency of vector retrieval. If the starting position in the first vector connection graph is close to the finally retrieved vector, the device will traverse fewer vectors in the first vector connection graph during the vector retrieval, thus resulting in higher efficiency. Conversely, if the starting position in the first vector connection graph is far from the finally retrieved vector, the device will traverse more vectors in the first vector connection graph during the vector retrieval, resulting in lower efficiency.
[0122] Optionally, in order to quickly retrieve the vector most similar to the query vector in the first vector connection graph, the execution device may first determine the retrieval entry point of the first vector connection graph. The retrieval entry point is a vector in the first vector connection graph, and the retrieval entry point is used to indicate the starting point of vector retrieval.
[0123] Therefore, when performing vector retrieval based on the first vector connection graph, the execution device uses the retrieval entry point in the first vector connection graph as the initial position for retrieval, and thus begins to perform vector retrieval.
[0124] For example, when determining the retrieval entry point of the first vector connection graph, the execution device first obtains a second vector connection graph, which records the connection relationships between a subset of vectors in the vector set. That is, while the first vector connection graph indicates all vectors in the vector database, the second vector connection graph actually only indicates a subset of the vectors in the vector database; that is, the vectors indicated by the second vector connection graph are a subset of the vectors indicated by the first vector connection graph. For example, the number of vectors indicated by the second vector connection graph may be 5%, 10%, or 20% of the total number of vectors indicated by the first vector connection graph.
[0125] Then, based on the query vector, the execution device performs vector retrieval in the second vector connection graph to obtain the retrieval results of the second vector connection graph, which are used as the retrieval entry point.
[0126] In simple terms, the second vector connection graph is essentially a simplified version of the first vector connection graph, indicating far fewer vectors than the first. Therefore, this solution first performs vector retrieval in the second vector connection graph, which has fewer vectors, to quickly locate the approximate position of the vector closest to the query vector. Then, based on the position retrieved from the second vector connection graph, further vector retrieval is performed in the first vector connection graph. This helps shorten the retrieval path in the first vector connection graph, which has a large number of vectors, thus improving the overall efficiency of vector retrieval.
[0127] It should be noted that when constructing the second vector connectivity graph, a subset of vectors can be selected from all vectors indicated by the first vector connectivity graph by randomly selecting vectors. Alternatively, the second vector connectivity graph can be constructed by first performing clustering on all vectors indicated by the first vector connectivity graph, and then extracting a subset of vectors from each cluster. In general, this application does not limit the method of constructing the second vector connectivity graph.
[0128] Furthermore, after determining the vectors used to construct the second vector connectivity graph, the second vector connectivity graph can be constructed based on the first-level quantization data of the vectors, thereby improving the construction efficiency of the second vector connectivity graph and ensuring its accuracy.
[0129] Optionally, during the vector retrieval process in the second vector connection graph, the execution device first performs a vector retrieval in the second vector connection graph based on a depth-first search method to obtain the target vector. The target vector is a vector included in the second vector connection graph, and it is the vector retrieved from the second vector connection graph based on the depth-first search method that is closest to the query vector.
[0130] Then, the execution device uses the neighbor vectors of the target vector in the second vector connection graph as the starting point for retrieval, and performs vector retrieval in the second vector connection graph based on the breadth-first search method to obtain the retrieval results.
[0131] In other words, the execution device first performs a search in the second vector connection graph based on the depth-first search method, and then performs a breadth-first search based on the search results of the depth-first search method, thereby completing the vector retrieval in the second vector connection graph.
[0132] Specifically, in the process of performing vector retrieval based on depth-first search, the execution device starts from the entry point of the second vector connection graph, calculates the distance between the vectors corresponding to all neighbors of the current node and the query vector, and then determines the next node of the retrieval path, until the distance between the vectors corresponding to all neighbors of the node and the query vector is not less than the distance between the node's own vector and the query vector. In other words, the execution device actually searches deeper and deeper along a retrieval path until it can no longer search, and there is always only one retrieval path.
[0133] During the vector retrieval process based on breadth-first search, the execution device will perform a divergent search along the retrieval starting point (i.e., the neighbor vectors of the target vector in the second vector connection graph), thereby forming multiple retrieval paths until no vector closer to the already retrieved vector can be found.
[0134] In summary, the process of first searching using a depth-first search method and then searching using a breadth-first search method in this scheme is actually to first delve deeper along a search path, and then radiate multiple search paths at the end of that search path to perform the search.
[0135] For example, please refer to Figure 6, which is a comparative schematic diagram of a retrieval path provided by this application. As shown in Figure 6, in the existing scheme, the retrieval path proceeds in a scattering manner, so the number of nodes (i.e., vectors) that need to be retrieved on the retrieval path is relatively large. In this scheme, the retrieval path first proceeds in a linear manner, and then proceeds in a scattering manner.
[0136] Clearly, compared to existing solutions, this approach, which first performs retrieval based on depth-first search and then on breadth-first search, can quickly approximate the nearest neighbor of the query vector before expanding the retrieval scope, avoiding getting trapped in local optima, improving the accuracy of vector retrieval, and ultimately ensuring that vector retrieval can be completed at a high speed.
[0137] Optionally, before performing vector retrieval in the second vector connectivity graph based on a depth-first search, the execution device can also determine the retrieval entry point of the second vector connectivity graph. For example, the execution device can determine the retrieval entry point of the second vector connectivity graph using a k-means clustering algorithm, such as Hierarchical Balance K-means (HBK-means) clustering. Of course, the execution device can also determine the retrieval entry point of the second vector connectivity graph using other methods, and this application does not specifically limit this method.
[0138] When using the k-means algorithm, the execution device first performs clustering on all vectors indicated by the second vector connection graph, obtaining cluster centers (i.e., center vectors of multiple categories). Then, the execution device searches the second vector connection graph for the vector closest to each cluster center, thus obtaining multiple entry point vectors. By calculating the distance between each entry point vector and the query vector, the entry point vector closest to the query vector can be determined, and this closest entry point vector is used as the retrieval entry point for the second vector connection graph.
[0139] The above describes the process of performing vector retrieval based on vector connection graphs. The following will describe how to generate vector retrieval results based on the candidate set after completing the vector retrieval.
[0140] For example, after the vector retrieval performed based on the first vector connectivity graph is completed, the execution device can obtain a final candidate set. Thus, the execution device can acquire the vectors (i.e., the original vector data) from the candidate set. For instance, the execution device can read the original vector data from the aforementioned first storage medium.
[0141] Furthermore, by calculating the distance between the vectors in the candidate set and the query vector, the execution device determines the vector retrieval result, which is used to indicate one or more vectors recorded in the candidate set.
[0142] For example, after recalculating the distance between the vectors in the candidate set and the query vector, the execution device selects one or more vectors from the candidate set that are closest to the query vector as vector retrieval results, and then returns the corresponding vector retrieval results to the user.
[0143] Generally, the number of vectors in the candidate set is often greater than the number of vectors in the vector retrieval results. For example, the candidate set may contain 30, 50, or 100 vectors, while the vector retrieval results often only require 1, 3, 5, or 10 vectors. Therefore, after completing the vector retrieval and obtaining the candidate set, it is often necessary to select a subset of vectors from the candidate set to obtain the vector retrieval results. To obtain accurate vector retrieval results, this solution recalculates the distance between the original vector data and the query vector, thereby obtaining the accurate distance between each vector in the candidate set and the query vector. Based on this candidate set, accurate vector retrieval results are obtained, ensuring the precision of the vector retrieval.
[0144] In summary, in this application, secondary quantization data is used during vector retrieval to calculate the distance between the vector and the query vector, facilitating rapid vector filtering. Primary quantization data is used to correct the distance between the vectors in the candidate set and the query vector, ensuring accurate updating of the candidate set. The original vector data is used after vector retrieval to further correct the distance between the vectors in the candidate set and the query vector, resulting in accurate vector retrieval results.
[0145] The execution process of the vector retrieval method provided in this application has been described above. For ease of understanding, the execution process of the vector retrieval method provided in this application will be detailed below with specific examples in practical applications.
[0146] Specifically, to implement the vector retrieval method provided in this application, in practical applications, the execution device needs to perform a graph construction process and a retrieval process. The graph construction process is used to construct quantized data and a vector connection graph for performing vector retrieval. The vector retrieval process is then performed based on the vector connection graph and the quantized data. Generally, after completing the graph construction process, for different query vectors, the corresponding vector retrieval process can be performed based on the same vector connection graph.
[0147] For example, please refer to Figure 7, which is a flowchart illustrating a graph construction process provided in this application. As shown in Figure 7, during the graph construction process, for vectors in the vector database, the execution device needs to perform first-level quantization on the vectors based on a first-level quantizer (i.e., perform quantization on the vectors using a first quantization method) to obtain first-level quantized data; and perform second-level quantization on the vectors based on a second-level quantizer (i.e., perform quantization on the vectors using a second quantization method) to obtain second-level quantized data.
[0148] In this context, when performing first-level quantization on a vector using a first-level quantizer, the compression level can be determined based on the accuracy requirements of vector retrieval, thus obtaining first-level quantized data that meets the accuracy requirements. In other words, the first-level quantized data is obtained under precision constraints. Similarly, when performing first-level quantization on a vector using a second-level quantizer, the compression level can be determined based on the storage medium (such as memory) for storing the second-level quantized data, ensuring that all second-level quantized data can be stored in memory. In other words, the second-level quantized data is obtained under memory constraints.
[0149] For the obtained primary and secondary quantization data, the primary quantization data can be stored in a storage medium with a large capacity but a low read / write speed, such as a disk; while the secondary quantization data can be stored in a storage medium with a small capacity but a high read / write speed, such as memory.
[0150] Furthermore, after obtaining the first-level quantized data, the distance between the corresponding first-level quantized data of a vector can be calculated as the vector distance, thereby constructing a vector connectivity graph. For example, a Disk graph (i.e., the first vector connectivity graph mentioned above) can be constructed based on all vectors in the vector database, and a Sketch graph (i.e., the second vector connectivity graph mentioned above) can be constructed based on a subset of vectors in the vector database. The vectors included in the Sketch graph and their first-level quantized data can be stored in memory. The vectors included in the Disk graph and their first-level quantized data can be stored on disk.
[0151] In summary, memory can store the second-order quantized data of all vectors in the vector database, the vectors included in the Sketch graph, and the first-order quantized data of the vectors. Disk can store the raw data of all vectors in the vector database, the vectors included in the Disk graph, and the first-order quantized data of the vectors.
[0152] For example, suppose the current vector database stores 10 billion vectors, each with a dimension of 1024, and the original vector data is of data type FP32 (32-bit single-precision floating-point number). The memory size used to store the second-order quantized data is 512 gigabytes (GB). Then, when performing second-order quantization, the compression factor of second-order quantization can be calculated using the following formula 1.
[0153] Specifically, the compression factor of second-order quantization can be calculated by dividing the size of the original vector data by the available memory size for the second-order quantized data. In Equation 1, since each FP32 digit occupies 4 bytes, This represents the conversion from bytes to GB, therefore The value represents the size of all original vector data; furthermore, 10000 in the denominator of Formula 1 represents the number of vectors included in the Sketch graph. Table 1 shows the available content of the second-order quantized data in Formula 1.
[0154] Table 1
[0155] Here, we assume that the storage format of the ID mapping table is id:(pageid, offset), which is int64:(int64, int8).
[0156] Based on Formula 1 above, it can be determined that a quantization method with a compression factor greater than or equal to 10⁸ should be used to perform secondary quantization, thereby obtaining secondary quantized data. Additionally, the execution device can use scalar quantization-int8 (SQ8) to perform primary quantization, thereby obtaining primary quantized data. Based on the primary quantized data, a sketch graph and a disk graph can be constructed. Specifically, the constraints for constructing the sketch graph and disk graph are shown in Table 2.
[0157] Table 2
[0158] Here, SG vertex count represents the number of vectors included in the Sketch graph, and SG degree represents the number of neighbor vectors of each vector in the Sketch graph.
[0159] For example, please refer to Figure 8, which is a flowchart illustrating a vector retrieval process provided in this application. As shown in Figure 8, the vector retrieval process includes the following steps.
[0160] Step 1: Perform first-level quantization and second-level quantization on the query vector to obtain the first-level quantized data and second-level quantized data of the query vector.
[0161] First, in order to calculate the distance between the query vector and the first-level and second-level quantized data of the vector, the execution device first performs first-level quantization and second-level quantization on the query vector using a first-level quantizer and a second-level quantizer, respectively, to obtain the first-level and second-level quantized data of the query vector.
[0162] Step 2: Based on the first-level quantized data of the query vector, perform vector retrieval in Sketch Graph to obtain the candidate set.
[0163] Specifically, since the Sketch graph is constructed based on the first-level quantized data of vectors, its content can be represented by the following data storage structure: the data storage structure includes multiple rows of data, each row containing a vector index in the Sketch graph, the other vector indices adjacent to that vector index, and the first-level quantized data corresponding to that vector index. That is, the Sketch graph can indicate the neighboring vectors of each vector and the first-level quantized data of that vector.
[0164] Therefore, based on the first-level quantized data of the vector index indicated by the Sketch graph, vector retrieval can be performed in the Sketch graph by calculating the distance between the first-level quantized data of the query vector and the first-level quantized data of the vectors in the Sketch graph, thus obtaining a candidate set. The candidate set includes multiple vectors retrieved from the Sketch graph that are closest to the query vector.
[0165] Furthermore, since the Sketch graph contains a limited number of vectors, the vectors and their first-level quantization data can be stored in memory. Therefore, vector retrieval within the Sketch graph can be performed directly based on the data stored in memory, eliminating the need to read data from disk and ensuring efficient vector retrieval within the Sketch graph.
[0166] Step 3: Using the vectors in the candidate set as the entry point for retrieval in the Disk graph, continue to perform vector retrieval in the Disk graph.
[0167] Since the Sketch graph is a simplified version of the Disk graph, in order to obtain an accurate candidate set, it is necessary to use the vectors in the candidate set obtained by performing a search on the Sketch graph as the entry point for the Disk graph, and then continue to perform vector search in the Disk graph.
[0168] Step 4: When performing vector retrieval in the Disk graph, the distance between the query vector and the vectors in the Disk graph is calculated based on the secondary quantization data, thereby updating the candidate set.
[0169] To improve the efficiency of distance calculation, when performing vector retrieval in the Disk graph, the execution device calculates the distance between the query vector and the vectors in the Disk graph based on secondary quantization data, thereby determining whether the retrieved vector should be added to the candidate set, and thus updating the candidate set.
[0170] Furthermore, since the secondary quantization data is stored in memory, vector retrieval in Disk graph can be performed by retrieving the secondary quantization data from memory, eliminating the need to read vector data from disk and improving the efficiency of vector retrieval.
[0171] Step 5: After the candidate set is updated, calculate and update the distance between the query vector and the vectors in the candidate set based on the first-level quantization data.
[0172] If a new vector is added to the candidate set, the execution device will calculate the distance between the first-level quantized data of the new vector and the first-level quantized data of the query vector, thereby updating the distance between the vectors in the candidate set and the query vector, ensuring the accuracy of the distance, and thus guaranteeing the accurate updating of the candidate set.
[0173] Since the execution device only needs to read the first-level quantized data from the disk to perform distance calculation after the candidate set is updated, the execution device actually reads relatively little first-level quantized data. Therefore, storing the first-level quantized data in a storage medium with a slower read speed will not have a significant impact on the vector retrieval process.
[0174] Step 6: After the vector retrieval based on the Disk graph is completed, the distance between the query vector and the vectors in the candidate set is corrected based on the original vector data.
[0175] After the disk graph-based vector retrieval is completed, a final candidate set is obtained, and the distance between the vectors in the candidate set and the query vector is calculated based on the first-level quantized data. To ensure that accurate vector retrieval results can be generated subsequently based on the candidate set, the execution device recalculates the distance between the query vector and the vectors in the candidate set based on the original vector data, thereby correcting the distance between the vectors in the candidate set and the query vector.
[0176] Specifically, during the vector retrieval process on the Disk graph, if all neighbor vectors of a vector in the candidate set have been retrieved on the Disk graph and no new neighbor vectors can be added to the candidate set, then the vector retrieval on the Disk graph can be considered complete.
[0177] Step 7: Based on the corrected vector distance in the candidate set, select k vectors in the candidate set as vector retrieval results.
[0178] For example, the execution device selects the k vectors that are closest to the query vector in the candidate set as the vector retrieval results, where k is an integer greater than or equal to 1.
[0179] The method provided in this application has been described in detail above. Next, the device provided in this application for performing the above method will be described.
[0180] Please refer to Figure 9, which is a schematic diagram of the structure of a vector retrieval device provided in this application. As shown in Figure 9, the vector retrieval device includes: an acquisition module 901, used to acquire a query vector and a first vector connection graph, the first vector connection graph being used to record the connection relationships between vectors in the vector set; and a processing module 902, used to update a candidate set by calculating the distance between secondary quantized data and the query vector during the vector retrieval process based on the first vector connection graph, the candidate set being used to record multiple vectors that are closest to the query vector, and the candidate set being used to generate vector retrieval results after the vector retrieval is completed, the distance between the vectors in the candidate set and the query vector being calculated based on primary quantized data; wherein, the primary quantized data is obtained by quantizing the vectors in the vector set using a first quantization method, the secondary quantized data is obtained by quantizing the vectors in the vector set using a second quantization method, and the data compression degree of the second quantization method is greater than that of the first quantization method.
[0181] In one possible implementation, primary quantization data is stored in a first storage medium, and secondary quantization data is stored in a second storage medium, with the second storage medium having a higher read / write speed than the first storage medium.
[0182] In one possible implementation, the first storage medium is a persistent storage medium, and the second storage medium is memory.
[0183] In one possible implementation, the degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
[0184] In one possible implementation, the degree of data compression in the first quantization method is determined based on the accuracy requirements of vector retrieval.
[0185] In one possible implementation, the processing module 902 is further configured to: determine the retrieval entry point of the first vector connection graph, wherein the retrieval entry point is a vector in the first vector connection graph, and the retrieval entry point is used to indicate the starting point of vector retrieval.
[0186] In one possible implementation, the acquisition module 901 is further configured to acquire a second vector connection graph, which records the connection relationships between some vectors in the vector set; the processing module 902 is further configured to perform vector retrieval based on the query vector in the second vector connection graph to obtain the retrieval results of the second vector connection graph, which are used as retrieval entry points.
[0187] In one possible implementation, the processing module 902 is further configured to: perform vector retrieval in the second vector connection graph based on a depth-first search method to obtain the target vector; and perform vector retrieval in the second vector connection graph based on a breadth-first search method, using the neighbor vectors of the target vector in the second vector connection graph as the retrieval starting point, to obtain the retrieval result.
[0188] In one possible implementation, after the vector retrieval performed based on the first vector connection graph is completed, the acquisition module 901 is further used to acquire vectors in the candidate set; the processing module 902 is further used to determine the vector retrieval result by calculating the distance between the vectors in the candidate set and the query vector, and the vector retrieval result is used to indicate one or more vectors recorded in the candidate set.
[0189] In one possible implementation, the first vector connectivity graph is constructed by calculating the distances between vectors in the vector set based on first-level quantized data.
[0190] In one possible implementation, the processing module 902 is further configured to calculate the distance between the vectors in the candidate set and the query vector based on the first-level quantized data after the candidate set is updated.
[0191] Both the acquisition module 901 and the processing module 902 can be implemented in software or in hardware. For example, the implementation of the processing module 902 will be described below. Similarly, the implementation of the acquisition module 901 can be referenced from the implementation of the processing module 902.
[0192] As an example of a software functional unit, processing module 902 may include code running on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, or a container. Further, the aforementioned computing instance may be one or more. For example, processing module 902 may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code may be distributed within the same region or in different regions. Further, the multiple hosts / virtual machines / containers used to run the code may be distributed within the same availability zone (AZ) or in different AZs, each AZ including one or more geographically proximate data centers. Typically, a region may include multiple AZs.
[0193] Similarly, multiple hosts / virtual machines / containers used to run this code can be distributed within the same Virtual Private Cloud (VPC) or across multiple VPCs. Typically, a VPC is set up within a region. Communication between two VPCs within the same region, as well as between VPCs in different regions, requires a communication gateway to be set up within each VPC to enable interconnection between VPCs.
[0194] As an example of a hardware functional unit, the processing module 902 may include at least one computing device, such as a server. Alternatively, the processing module 902 may be implemented using a central processing unit (CPU), an application-specific integrated circuit (ASIC), or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a neural network processing unit (NPU), a system-on-chip (SoC), an offload card, an accelerator card, or any combination thereof.
[0195] The processing module 902 includes multiple computing devices that can be distributed within the same region or in different regions. Similarly, the processing module 902 can be distributed within the same Availability Zone (AZ) or in different AZs. Likewise, the processing module 902 can be distributed within the same Virtual Private Cloud (VPC) or multiple VPCs. These multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, GALs, DPUs, NPUs, SoCs, offloading cards, and accelerator cards.
[0196] Please refer to Figure 10, which is a schematic diagram of the structure of a computing device provided in this application. The computing device 1000 shown in Figure 10 can be used to execute the vector retrieval method provided in this embodiment. As shown in Figure 10, the computing device 1000 includes: a bus 1002, a processor 1004, a memory 1006, and a communication interface 1008. The processor 1004, the memory 1006, and the communication interface 1008 communicate with each other via the bus 1002. The computing device 1000 can be a server or a terminal device. It should be understood that this application does not limit the number of processors and memories in the computing device 1000.
[0197] Bus 1002 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one line is used in Figure 10, but this does not imply that there is only one bus or one type of bus. Bus 1002 can include pathways for transmitting information between various components of computing device 1000 (e.g., memory 1006, processor 1004, communication interface 1008).
[0198] The processor 1004 may include any one or more processors such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0199] The memory 1006 may include volatile memory, such as random access memory (RAM). The processor 1004 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid state drive (SSD).
[0200] The memory 1006 stores executable program code, and the processor 1004 executes this executable program code to implement the functions of the aforementioned acquisition module and processing module, thereby realizing the vector retrieval method described above. That is, the memory 1006 stores instructions for executing the vector retrieval method.
[0201] The communication interface 1008 uses transceiver modules such as, but not limited to, network interface cards and transceivers to enable communication between the computing device 1000 and other devices or communication networks.
[0202] This application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
[0203] Please refer to Figure 11, which is a schematic diagram of a computing device cluster provided in this application. As shown in Figure 11, the computing device cluster includes at least one computing device 1000. The memory 1006 of one or more computing devices 1000 in the computing device cluster may store the same instructions for executing vector retrieval methods.
[0204] In some possible implementations, the memory 1006 of one or more computing devices 1000 in the computing device cluster may also store partial instructions for executing the vector retrieval method. In other words, a combination of one or more computing devices 1000 can jointly execute the instructions for executing the vector retrieval method.
[0205] It should be noted that the memory 1006 in different computing devices 1000 within the computing device cluster can store different instructions, each used to execute a portion of the functions of the vector retrieval method apparatus. That is, the instructions stored in the memory 1006 of different computing devices 1000 can implement the functions of one or more of the aforementioned acquisition and processing modules.
[0206] In some possible implementations, one or more computing devices in a computing device cluster can be connected via a network. This network can be a wide area network (WAN) or a local area network (LAN), etc. Figure 12 illustrates one possible implementation. Figure 12 is a schematic diagram of another computing device cluster structure provided in this application. As shown in Figure 12, in computing device cluster 1200, two computing devices 1000A and 1000B are connected via a network. Specifically, they are connected to the network through communication interfaces in each computing device. In this type of possible implementation, the memory 1006 in computing device 1000A stores instructions for executing the functions of the acquisition module. Simultaneously, the memory 1006 in computing device 1000B stores instructions for executing the functions of the processing module.
[0207] It should be understood that the functions of computing device 1000A shown in Figure 12 can also be performed by multiple computing devices 1000. Similarly, the functions of computing device 1000B can also be performed by multiple computing devices 1000.
[0208] This application also provides a chip comprising a processing unit and a communication unit. The processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, pins, or circuits. The processing unit can execute computer execution instructions stored in a storage unit to cause the chip within the electronic device to perform the methods described in the above embodiments. Optionally, the storage unit may be an in-chip storage unit, such as a register or cache. Alternatively, the storage unit may be an external storage unit located within a wireless access device, such as a read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions, such as random access memory (RAM).
[0209] Referring to Figure 13, which is a schematic diagram of the structure of a computer-readable storage medium provided in this application. This application also provides a computer-readable storage medium in which, in some embodiments, the method disclosed in Figure 3 can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of art.
[0210] Figure 13 schematically illustrates a conceptual partial view of an example computer-readable storage medium arranged according to at least some of the embodiments shown herein, the example computer-readable storage medium including a computer program for executing computer processes on a computing device.
[0211] In one embodiment, the computer-readable storage medium 1300 is provided using a signal bearer medium 1301. The signal bearer medium 1301 may include one or more program instructions 1302, which, when executed by one or more processors, can provide the functions or parts thereof described above with reference to FIG3.
[0212] In some examples, the signal carrying medium 1301 may include a computer-readable medium 1303, such as, but not limited to, a hard disk drive, a compact disc (CD), a digital video optical disc (DVD), a digital magnetic tape, a memory, ROM, or RAM, etc.
[0213] In some embodiments, the signal-bearing medium 1301 may include a computer-recordable medium 1304, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal-bearing medium 1301 may include a communication medium 1305, such as, but not limited to, digital and / or analog communication media (e.g., fiber optic cables, waveguides, wired communication links, wireless communication links, etc.). Therefore, for example, the signal-bearing medium 1301 may be transmitted by a wireless communication medium 1305 (e.g., a wireless communication medium conforming to the IEEE 1102.X standard or other transmission protocols).
[0214] One or more program instructions 1302 may be, for example, computer-executable instructions or logical implementation instructions. In some examples, the computing device may be configured to provide various operations, functions, or actions in response to one or more program instructions 1302 conveyed to the computing device via a computer-readable medium 1303, a computer-recordable medium 1304, and / or a communication medium 1305.
[0215] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the accompanying drawings of the device embodiments provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0216] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods of the various embodiments of this application.
[0217] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0218] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, computer instructions can be transferred from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A vector retrieval method, characterized in that, include: Obtain the query vector and the first vector connection graph, where the first vector connection graph is used to record the connection relationships between vectors in the vector set; During the vector retrieval process based on the first vector connection graph, the candidate set is updated by calculating the distance between the secondary quantized data and the query vector. The candidate set is used to record the multiple vectors that are closest to the query vector. The candidate set is used to generate vector retrieval results after the vector retrieval is completed. The distance between the vectors in the candidate set and the query vector is calculated based on the primary quantized data. The first-level quantized data is obtained by quantizing the vectors in the vector set using a first quantization method, and the second-level quantized data is obtained by quantizing the vectors in the vector set using a second quantization method, wherein the data compression degree of the second quantization method is greater than that of the first quantization method.
2. The method according to claim 1, characterized in that, The primary quantization data is stored in a first storage medium, and the secondary quantization data is stored in a second storage medium. The read / write speed of the second storage medium is higher than that of the first storage medium.
3. The method according to claim 2, characterized in that, The second storage medium is memory.
4. The method according to claim 2 or 3, characterized in that, The degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
5. The method according to any one of claims 1-4, characterized in that, The degree of data compression in the first quantization method is determined based on the accuracy requirements of vector retrieval.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Determine the retrieval entry point of the first vector connection graph, wherein the retrieval entry point is a vector in the first vector connection graph, and the retrieval entry point is used to indicate the starting point of vector retrieval.
7. The method according to claim 6, characterized in that, Determining the retrieval entry point of the first vector connection graph includes: Obtain a second vector connection graph, which is used to record the connection relationships between some vectors in the vector set; Based on the query vector, a vector retrieval is performed in the second vector connection graph to obtain the retrieval results of the second vector connection graph, and the retrieval results are used as the retrieval entry point.
8. The method according to claim 7, characterized in that, The step of performing vector retrieval in the second vector connection graph includes: Vector retrieval is performed in the second vector connectivity graph using a depth-first search approach to obtain the target vector. Using the neighbor vectors of the target vector in the second vector connection graph as the starting point for retrieval, a vector retrieval is performed in the second vector connection graph based on a breadth-first search method to obtain the retrieval result.
9. The method according to any one of claims 1-8, characterized in that, After the vector retrieval performed based on the first vector connection graph is completed, the method further includes: Obtain the vectors from the candidate set; The vector retrieval result is determined by calculating the distance between the vectors in the candidate set and the query vector. The vector retrieval result is used to indicate one or more vectors recorded in the candidate set.
10. The method according to any one of claims 1-9, characterized in that, The first vector connection graph is constructed by calculating the distance between vectors in the vector set based on the first-level quantized data.
11. The method according to any one of claims 1-10, characterized in that, The method further includes: After the candidate set is updated, the distance between the vector in the candidate set and the query vector is calculated based on the first-level quantization data.
12. A vector retrieval device, characterized in that, include: The acquisition module is used to acquire the query vector and the first vector connection graph, wherein the first vector connection graph is used to record the connection relationships between vectors in the vector set; The processing module is used to update the candidate set by calculating the distance between the secondary quantized data and the query vector during the vector retrieval process based on the first vector connection graph. The candidate set is used to record multiple vectors that are closest to the query vector. The candidate set is used to generate vector retrieval results after the vector retrieval is completed. The distance between the vectors in the candidate set and the query vector is calculated based on the primary quantized data. The first-level quantized data is obtained by quantizing the vectors in the vector set using a first quantization method, and the second-level quantized data is obtained by quantizing the vectors in the vector set using a second quantization method, wherein the data compression degree of the second quantization method is greater than that of the first quantization method.
13. The apparatus according to claim 12, characterized in that, The primary quantization data is stored in a first storage medium, and the secondary quantization data is stored in a second storage medium. The read / write speed of the second storage medium is higher than that of the first storage medium.
14. The apparatus according to claim 13, characterized in that, The first storage medium is a persistent storage medium, and the second storage medium is memory.
15. The apparatus according to claim 13 or 14, characterized in that, The degree of data compression in the second quantization method is determined based on the capacity of the second storage medium.
16. The apparatus according to any one of claims 12-15, characterized in that, The degree of data compression in the first quantization method is determined based on the accuracy requirements of vector retrieval.
17. The apparatus according to any one of claims 12-16, characterized in that, The processing module is further configured to: Determine the retrieval entry point of the first vector connection graph, wherein the retrieval entry point is a vector in the first vector connection graph, and the retrieval entry point is used to indicate the starting point of vector retrieval.
18. The apparatus according to claim 17, characterized in that, The acquisition module is further configured to acquire a second vector connection graph, which is used to record the connection relationships between some vectors in the vector set; The processing module is further configured to perform vector retrieval in the second vector connection graph based on the query vector, and obtain the retrieval result of the second vector connection graph, wherein the retrieval result is used as the retrieval entry point.
19. The apparatus according to claim 18, characterized in that, The processing module is further configured to: Vector retrieval is performed in the second vector connectivity graph using a depth-first search approach to obtain the target vector. Using the neighbor vectors of the target vector in the second vector connection graph as the starting point for retrieval, a vector retrieval is performed in the second vector connection graph based on a breadth-first search method to obtain the retrieval result.
20. The apparatus according to any one of claims 12-19, characterized in that, After the vector retrieval performed based on the first vector connection graph is completed, the acquisition module is further configured to acquire vectors in the candidate set; The processing module is further configured to determine the vector retrieval result by calculating the distance between the vectors in the candidate set and the query vector, wherein the vector retrieval result is used to indicate one or more vectors recorded in the candidate set.
21. A computing device, characterized in that, The device includes a memory and a processor; the memory stores code, and the processor is configured to execute the code, wherein when the code is executed, the computing device performs the method as described in any one of claims 1 to 11.
22. A computing device cluster, characterized in that, It includes at least one computing device, each computing device including a processor and memory; The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device to cause the cluster of computing devices to perform the operational steps of the method as described in any one of claims 1 to 11.
23. A computer storage medium, characterized in that, The computer storage medium stores instructions that, when executed by the computer, cause the computer to perform the method according to any one of claims 1 to 11.
24. A computer program product, characterized in that, The computer program product stores instructions that, when executed by a computer, cause the computer to perform the method described in any one of claims 1 to 11.