Query for vectorized representations

By comparing the reference distance between the candidate vectorized representation and the target vectorized representation, the query process is terminated in advance, and the problem of insufficient time delay in traditional query solutions is solved, and the query efficiency of vectorized representation is improved.

CN119293087APending Publication Date: 2025-01-10MICROSOFT TECHNOLOGY LICENSING LLC
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310840736.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-10
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

Traditional semantic analysis-based query schemes are difficult to effectively query vectorized representation in a short time, especially in online query services, which are difficult to meet strict delay requirements.

Method used

A query scheme based on the comparison of reference distance between the candidate vectorized representation and the target vectorized representation is proposed. By determining the first reference distance and the second reference distance, it is determined whether the query process is stopped, so as to end the query process in advance and ensure the query is ensured. Accuracy and efficiency of results.

Benefits of technology

While ensuring the accuracy of query results, the query is completed as early as possible, which improves the query efficiency of vectorized representation and meets the delay requirements of online applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293087A_ABST
    Figure CN119293087A_ABST
Patent Text Reader

Abstract

According to the implementation of the invention, a query scheme for vectorized representation is provided. According to the scheme, a query request for a set of vectorized representations is received, which indicates a target vectorized representation. In a current query step of a query process of a set of vectorized representations, a first reference distance is determined based on a respective distance between a candidate vectorized representation and a target vectorized representation. The candidate vectorized representation is determined from a set of vectorized representations in a previous query step of the query process. A second reference distance is determined based at least on a distance between the queried vectorized representation in the current query step and the target vectorized representation. And determining that the query process is stopped at least based on the second reference distance being greater than the first reference distance. If the query process is stopped, a query result for the target vectorized representation is determined based on the candidate vectorized representation. In this way, query can be terminated as early as possible while the accuracy is ensured, so that the query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0001] Various query services have been widely used or have application prospects. Query services can usually find results that match the query target from a database or data set. Query services are crucial for applications such as search engines, e-commerce, and recommendation systems.

[0002] For example, with the development of deep learning technology, various types of data can be mapped to high-dimensional vectors. Such vectors are also called vectorized representations. For example, deep learning technology can be used to perform feature extraction on object data such as images, audio, video, and text to obtain high-dimensional vectorized representations of these objects. Traditional query solutions based on semantic analysis are difficult to implement queries for vectorized representations of such complex data. In particular, for online query services, it is usually necessary to determine the query results in a very short time. This puts forward more stringent latency requirements for queries against vectorized representations. Summary of the invention

[0003] According to an implementation of the present disclosure, a scheme for vectorized query is proposed. According to the scheme, a query request for a set of vectorized representations is received. The query request indicates a target vectorized representation. In a current query step of a query process for the set of vectorized representations, a first reference distance is determined based on a corresponding first distance between a candidate vectorized representation and a target vectorized representation. The candidate vectorized representation is determined from the set of vectorized representations in a previous query step of the query process. A second reference distance is determined based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step. It is determined that the query process stops based at least on the second reference distance being greater than the first reference distance. If the query process stops, a query result for the target vectorized representation is determined based on the candidate vectorized representation.

[0004] The solution disclosed in the present invention can complete the query and obtain the query result as early as possible while ensuring the accuracy of the query result. In this way, the query efficiency for vectorized representation is advantageously improved.

[0005] This section is provided to introduce a selection of objects in a simplified form, which will be further described in the detailed description below. This section is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS

[0006] Figure 1 A block diagram illustrating an example environment in which various implementations of the present disclosure can be implemented;

[0007] Figure 2A and Figure 2BThe traversal results of the vectorized representation set are shown respectively;

[0008] Figure 3 A schematic diagram showing relaxed monotonicity of a vectorized representation traversal according to some implementations of the present disclosure;

[0009] Figure 4 A schematic diagram showing an example architecture for querying vectorized representations according to some implementations of the present disclosure is shown;

[0010] Figure 5 A schematic diagram showing an example architecture for querying a vectorized representation having multiple attribute vector components according to some implementations of the present disclosure;

[0011] Figure 6 A flowchart showing a process for querying a vectorized representation according to some implementations of the present disclosure; and

[0012] Figure 7 A schematic block diagram of an electronic device capable of implementing multiple implementations of the present disclosure is shown. DETAILED DESCRIPTION

[0013] The present disclosure will now be discussed with reference to several example implementations. It should be understood that these implementations are discussed only to enable those skilled in the art to better understand and thus implement the present disclosure, rather than implying any limitation on the scope of the present disclosure.

[0014] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to". The term "based on" is to be interpreted as "based at least in part on". The terms "an implementation" and "an implementation" are to be interpreted as "at least one implementation". The term "another implementation" is to be interpreted as "at least one other implementation". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0015] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various implementations are described throughout this article, and any type of implementation may be included under any section / subsection. In addition, the implementation described in any section / subsection may be combined in any manner with any other implementation described in the same section / subsection and / or different sections / subsections.

[0016] As used herein, the term "model" can learn the association between the corresponding input and output from the training data, so that after the training is completed, the corresponding output can be generated for a given input. The generation of the model can be based on machine learning technology. Deep learning (DL) is a machine learning algorithm that processes inputs and provides corresponding outputs by using multi-layer processing units. Neural network is an example of a model based on deep learning. In this article, "model" may also be referred to as "machine learning model", "learning model", "machine learning network" or "learning network", and these terms are used interchangeably in this article.

[0017] As used herein, the terms "query process" and "traversal process", the terms "query step" and "traversal step", the terms "queried vector representation" and "traversed vector representation", and similar terms about "query" and "traversal" are used interchangeably. Although the term "traversal" is used for description in some implementations, it should be understood that the traversal of the vectorized collection is not required to be complete, that is, it is not required that each vectorized representation in the vectorized collection is visited.

[0018] Example Environment

[0019] Figure 1 A schematic diagram of an example environment 100 is shown in which implementations of the present disclosure can be implemented. Figure 1 In the environment 100, the electronic device 110 receives a query request 102. For example, the query request 102 may be input by a user via an input device. As another example, the query request 102 may also be issued by other devices or applications. The query request 102 indicates a target vectorized representation 112. The electronic device 110 or other device may determine the indicated target vectorized representation 112 based on the received query request 102. For example, if the query request includes an image, the target vectorized representation 112 may be a vectorized representation of the image. In the following, the target vectorized representation 112 may sometimes also be referred to as a query vector, but this is merely exemplary and is not intended to be limiting.

[0020] Based on the target vectorized representation 112, the electronic device 110 determines a query result 132 for the query request 102 from the vectorized representation set 120. For example, the electronic device 110 can search for vectorized representations similar to the target vectorized representation 122 from the vectorized representation set, and then determine the query result 132 based on the images corresponding to these vectorized representations.

[0021] To this end, the electronic device 110 may communicate with a database storing a vectorized representation set 120. The vectorized representation set 120 includes a vectorized representation 122-1, a vectorized representation 122-2, ..., a vectorized representation 122-N (N is a natural number greater than or equal to 1). For the purpose of explanation, in this document, the vectorized representation 122-1, the vectorized representation 122-2, ..., the vectorized representation 122-N may be individually referred to as a "vectorized representation 122", or collectively referred to as a "set of vectorized representations 122". The electronic device 110 may select a candidate vectorized representation that meets the query request 102 from a set of vectorized representations 122, and determine a query result 132 based on the candidate vectorized representation. The electronic device 110 may then provide the determined query result 132 to the user, or to other devices or applications that issued the query request 102.

[0022] In the implementation of the present disclosure, vectorized representations (including target vectorized representations 112 and vectorized representations 122 in vectorized representation set 120) may refer to representations of any appropriate type of object in the form of one or more vectors. Such objects may be various types of data information, such as text, images, audio, video, recipes, etc., or may be various types of entities, including but not limited to people, organizations, items, etc. In this document, the terms "vectorized representation" and "vector" are used interchangeably.

[0023] In some implementations, the vectorized representation may be a feature representation of an object extracted using deep learning techniques, such as a feature representation of an image or text. In some implementations, the vectorized representation may be a data item organized in vector form, such as a row or column of a data table. Exemplarily, each row in a data table of commodities corresponds to a commodity, and each column represents data of multiple dimensions of the commodity (e.g., price, manufacturer, sales volume, etc.). The vectorized representation may be a row of data in such a data table.

[0024] The vectorized representation may include one vector component or multiple vector components (sometimes also referred to as vectors). Each vector component may correspond to an attribute or modality, etc. Each vector component may have a corresponding index. In some implementations, the vectorized representation may include vector components corresponding to a single index. For example, the vectorized representation may include vector components of only visual attributes (or image modality), or vector components of only semantic attributes (or text modality), and so on. In some implementations, the vectorized representation may include multiple vector components corresponding to multiple indexes, respectively. Each index may be associated with an attribute or modality. For example, the vectorized representation for a recipe may include two vector components corresponding to two indexes, namely, a vector component representing an image of a dish and a vector component representing a text of a dish making process. In some implementations, the vectorized representation may also be associated with a scalar attribute. For example, each vectorized representation corresponds to a commodity and is associated with data such as the price and sales volume of the commodity.

[0025] Since vectorized representation can contain a variety of rich data, Figure 1 The query for vectorized representation shown can be used in a variety of applications, such as embedding-based retrieval, face recognition, code retrieval, question and answer applications, multiple search, redundancy detection, etc. In these various applications, there may be different query scenarios. Several examples of query scenarios for vectorized representation are listed below.

[0026] In an example query scenario, the query may be for a single attribute or modality. For example, the vectorized representation may include vector components of a single attribute or may only consider a single attribute. Accordingly, the electronic device 110 may determine one or more (e.g., K, K is an arbitrary natural number) vectorized representations 122 closest to the target vectorized representation 112 as the query result 132. This query may also be referred to as a TopK query on a single vector column, or a single vector TopK query. This query can typically be applied in embedding-based retrieval, recommendation systems, or question-answering systems.

[0027] In another example query scenario, compared to queries for vectorized representations with a single attribute, additional additional information, such as scalar attribute information, may also be considered in the query process. In this scenario, the query request 102 may also indicate a filtering condition. Taking product search as an example, the target vectorized representation 112 may be a vectorized representation of a product image, and the query request 102 also indicates a filtering condition about the product price. The electronic device 110 may find one or more vectorized representations 122 that are closest to the target vectorized representation 112 and meet the scalar attribute information constraints as query results 132. This search for vectorized representations may also be referred to as a single vector TopK query with scalar attribute filtering. Such queries may be applied in applications such as multiple queries.

[0028] In another example query scenario, the query may be for multiple attributes or modalities. In this case, the vectorized representation may have vector components corresponding to these attributes or modalities, respectively. For this multi-attribute vectorized representation, the cross results of multiple TopK searches for different attributes, respectively, may be determined as the query result 132. This type of query that comprehensively considers multiple attributes is also called a multi-column TopK query or a multi-attribute TopK query. Taking recipe retrieval as an example, the vector components of the two attributes, the text of the dish preparation process and the dish image, may be searched separately, and the results of the two searches may be comprehensively considered to obtain the query result 132. This multi-column TopK query may improve the result quality of query applications such as question-and-answer applications.

[0029] In another example scenario, similarity filtering can be applied to queries for vectorized representations. The electronic device 110 can search for vectorized representations from the vectorized representation set 120 whose similarity to the target vectorized representation 112 is greater than a similarity threshold. For example, in face recognition, a face similar to the target face is found from a database. This query scenario is also called vector similarity filtering.

[0030] Several example scenarios for queries represented by vectorization are described above, but this is only exemplary. The implementation of the present disclosure is not limited to these query scenarios. Other query scenarios are also possible, such as join queries. In addition, any combination of two or more query scenarios is also possible.

[0031] These examples can be applied to various online applications to improve the service quality of online applications. In some scenarios, online applications that apply queries for vectorized representations usually have strict latency requirements. For example, users of online applications usually expect to get feedback in a very short time. Such application latency is usually required to be within a few milliseconds. In this way, online applications can provide query results to users in real time, thereby improving user experience.

[0032] Several examples of determining the query result 132 for the query request 102 by the electronic device 110 are described above. In the environment 100, the electronic device 110 can be any type of device with computing capabilities, including a terminal device or a server device. The terminal device can be any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a media computer, a multimedia tablet, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device, or any combination of the foregoing, including accessories and peripherals of these devices or any combination thereof. The server device can include, for example, a computing system / server, such as a mainframe, an edge computing node, an electronic device in a cloud environment, and the like.

[0033] It should be understood that the structure and functionality of environment 100 are described for exemplary purposes only and does not imply any limitation on the scope of the present disclosure.

[0034] As briefly mentioned above, traditional semantic analysis-based query solutions are difficult to implement queries for vectorized representations of such complex data. In particular, for online query services, it is usually necessary to determine the query results in a very short time. This puts forward relatively strict latency requirements for queries against vectorized representations.

[0035] In a conventional solution, a search method such as K-nearest neighbor (KNN) is used to find one or more matching results with the highest similarity from the entire data (i.e., all data samples in the database). Although this solution can obtain accurate query results, it usually takes a long time. Considering that online search services usually need to quickly determine query results, such solutions are usually difficult to meet the strict time requirements of online search services.

[0036] In view of this, for such complex queries on vectorized representation, local search rather than full search can be used to find approximate matching results as the final query results. For this reason, an approximate vector search solution has been developed. In this solution, similar to relational databases, vector indexes are used to support approximate vector search, such as graph-based vector indexes or cluster-based vector indexes.

[0037] Taking clustering-based vector indexing as an example, during the traversal process, vectors in the database are clustered to obtain clusters. The center points of each cluster are compared with the query vector to determine one or more clusters that are closer. These one or more clusters are searched to obtain K vectors that are more matched.

[0038] Taking the graph-based vector index as an example, each vector in the database is used as a node of the graph, and the degree of difference between different vectors is determined as the distance between the corresponding nodes. In this way, the nodes of each vector in the corresponding database are connected into a relationship graph. During the traversal process, the entry node for the query can be randomly selected. The distance between the next search node and the entry node is selected according to the similarity between the entry node and the query vector. In this way, the next search node is continuously determined until the approximate K vectors are determined.

[0039] However, in these vector index solutions, a difficulty is how to determine the value of K. The value of K may vary greatly for different application scenarios and different queries, and is therefore difficult to predict. For example, in a query with a filter condition, if the value of K is set to a small value, the remaining vectors after the filter condition is screened may not be enough for the required number, and at least one more round of traversal is required. If the value of K is set to a large value, there may be more unnecessary traversal steps. Either way, the query performance is reduced.

[0040] To this end, the implementation of the present disclosure provides a query scheme for vectorized representations. According to the implementation of the present disclosure, a set of vectorized representations is traversed for a query request indicating a target vectorized representation. During the query process, a candidate vectorized representation is determined from the set of vectorized representations as at least a part of a candidate set in a previous query step of the query process. In the current query step, a first reference distance is determined based on the corresponding distances between the candidate vectorized representation and the target vectorized representation. For example, the maximum distance among these distances can be determined as the first reference distance. A second reference distance is determined based at least on a second distance between the currently queried vectorized representation and the target vectorized representation. Based at least on a comparison of the two reference distances, it is determined whether the query process is stopped. If the query process stops, a query result for the target vectorized representation is determined based on the candidate set.

[0041] In the implementation of the present disclosure, the comparison of the two reference distances can indicate the current trend of the query process, that is, whether the current query or search for the vectorized representation set has a trend away from the target vectorized representation. If the current query is moving away from the target vectorized representation, the query process can be stopped. According to the implementation of the present disclosure, an additional index query stop condition check is introduced, and the underlying index traversal logic may not be modified. The search can be completed and the query results can be obtained as early as possible while ensuring accuracy. In this way, the query efficiency for the vectorized representation is advantageously improved.

[0042] The following describes example embodiments of the present disclosure with continued reference to the accompanying drawings.

[0043] Relaxed monotonicity for vector indexing

[0044] As mentioned above, in order to solve the vector query problem, some vector indexing schemes have been proposed. Through the analysis of various vector indexing schemes, the implementation of the present disclosure proposes the relaxed monotonicity of the vector index. The relaxed monotonicity of the vector index will be described in detail below.

[0045] The inventors recognize that, unlike traditional scalar indexes, indexes for queries on high-dimensional vectors are usually designed for approximate TopK queries and cannot follow the monotonicity of the index. Figure 2A and Figure 2B The traversal results 200 and 250 of the vectorized representation set are shown respectively. Figure 2A In the example, cluster-based vector indexing is used for traversal. Figure 2B In the example, a graph-based vector index is used for traversal. For vector collections with these two vector indexes, multiple traversal experiments are conducted using TopK query as an example. Figure 2A and Figure 2B The traversal results 200 and 250 are shown respectively. The traversal results 200 and 250 respectively show the distance between the traversed vector and the query vector at different traversal steps.

[0046] By analyzing the traversal results 200 and 250, it can be noted that this method of traversing by vector index does not follow monotonicity. As the traversal process proceeds, the distance from the query vector fluctuates unpredictably. Due to the lack of monotonicity, it is impossible to find a query result that meets the query request based only on the index traversal.

[0047] Although the above traversal results 200 and 250 show a lack of monotonicity, both traversal results 200 and 250 show a similar two-stage traversal pattern. Figure 2AAs shown, in the left part of the dotted line 210 (also called the first stage of traversal), although there are fluctuations in the distance from the query vector, the index traversal is constantly approaching the target area where the query result is located. In the right part of the dotted line 210 (also called the second stage of traversal), the index traversal gradually stabilizes and gradually deviates from the target area. Figure 2A similar, Figure 2B A similar two-phase traversal pattern indicated by dashed line 260 is shown.

[0048] For the purpose of explanation, only Figure 2A and Figure 2B In fact, the inventors have analyzed queries for vectorized representations of various databases using different types of vector indexes, and similar traversal patterns are shown. In this two-stage traversal pattern, the query results are usually not found in the second stage of traversal. If the step of traversal entering the second stage can be found, the traversal can be ended in advance, thereby speeding up the process of determining the query results.

[0049] Based on this two-phase traversal mode, the implementation of the present disclosure proposes to relax monotonicity. Figure 2A and Figure 2B As shown, as the traversal of the first phase progresses, the distance between the traversed vector and the query vector gradually decreases in fluctuations, and becomes stable in the traversal of the second phase. This gradual decrease with fluctuations in the traversal of the first phase is called "relaxed monotonicity".

[0050] Combine the following Figure 3 To describe an example of the search process for a target vectorized representation. Figure 3 In the example, the order of traversal of the vectorized representations by index is shown in the trajectory 320 indicated by the dotted arrow in the figure, that is, the traversal is carried out in the order of vectorized representation 322, vectorized representation 324, vectorized representation 326, ...

[0051] In some implementations, in order to determine whether to enter the second stage of traversal, it is necessary to determine the scope of the neighboring area of ​​the target vectorized representation of the query request. Figure 3 In the example of , a spherical region range is used as an example for description, wherein the spherical region 310 represents the neighboring region of the target vectorized representation 301, also referred to as the target region. The query result for the target vectorized representation 301 may be located within the region 310. The region 310 has a radius 311, also referred to as the first reference distance. It should be understood that in some implementations, the target region may also have other shapes besides a sphere.

[0052] In the current traversal step s, the first reference distance, namely the radius 311, can be determined according to the result of the previous traversal. As an example, the radius 311 can be obtained by formula (1):

[0053] R q =Max(TopE({Distance(q,v j )|j∈[1,s-1]})) (1) where q represents the target vectorized representation 301, R q Indicates radius 311, v j Indicates the vectorized representation of the jth step being traversed, j is less than the current number of steps to be traversed s, Distance(q,v j ) represents the distance between the vectorized representation traversed in the jth step and the target vectorized representation 301, TopE represents the E vectorized representations closest to q (or most similar to q) among the vectorized representations traversed before the current traversal step s, and Max represents finding the maximum value. In other words, in this example, the maximum distance among the E vectorized representations (also called candidate vectorized representations) traversed before the current traversal step s is determined as the first reference distance, i.e., the radius 311.

[0054] It should be understood that in some implementations, other methods may be used to determine the radius 311. For example, the corresponding distances of the E candidate vectorized representations may be averaged, weighted averaged, or other appropriate operations may be performed to determine the radius 311. As an example, the average of the maximum distance and the second largest distance between the E candidate vectorized representations and the target vectorized representation q may be determined as the radius 311. The example implementations of the present disclosure are not limited in this respect.

[0055] Using the first reference distance, a target area or range in which the target vectorized representation may be located in the vector space can be indicated. In order to check monotonicity, it is necessary to consider the current index traversal position, which can characterize the distance between the currently traversed vectorized representation and the target vectorized representation, or can characterize the distance between the most recently traversed vectorized representation and the target vectorized representation. To this end, a second reference distance can be determined based at least on the distance between the currently traversed vectorized representation and the target vectorized representation. The second reference distance corresponds to all current traversal positions.

[0056] In some implementations, the current index traversal position may represent the distance between the vectorized representation traversed in the current traversal step and the target vectorized representation. Accordingly, the distance between the currently traversed vectorized representation and the target vectorized representation may be determined as the second reference distance.

[0057] In some implementations, the current index traversal position can represent the corresponding distances between multiple vectorized representations and the target vectorized representation within the current traversal window (including the most recent several traversal steps, also referred to as a traversal step window or a scan window). Accordingly, the second reference distance can be determined based on the corresponding distances (also referred to as the second distance) between multiple vectorized representations and the target vectorized representation within the traversal window 340. The current traversal window 340 refers to a window that includes the vectorized representation traversed in the current step and a predetermined number of vectorized representations traversed before it. It should be understood that in some implementations, a single vectorized representation may be included in the traversal window, that is, the length of the traversal window may be 1.

[0058] In some implementations, the second reference distance may be determined by averaging, weighted averaging, or other appropriate operations on the corresponding distances between the vectorized representations in the traversal window 340 and the target vectorized representation. The example implementations of the present disclosure are not limited in this regard.

[0059] In some implementations, when the traversal window 340 includes multiple vectorized representations, the median distance of the corresponding distances between these vectorized representations and the target vectorized representation can be determined as the second reference distance. In this implementation, the second reference distance can be expressed as formula (2):

[0060]

[0061] in, represents the second reference distance, w represents the size of the traversal window 340 (ie, the number of vectorized representations in the traversal window 340), and v i represents the vectorized representation in the traversal window 340, Distance(q, v i ) represents the vectorized representation v i The distance between the target vectorized representation 301 and Median represents the median distance.

[0062] By using the median distance as the second reference distance, outlier vectorized representations in the traversal window, such as vectorized representations 342 and 346, can be discarded. These outlier vectorized representations have too large or too small distances from the target vectorized representation compared to other vectorized representations in the traversal window 340, which can easily cause deviations in the determination result of the second reference distance. Using the median distance as the second reference distance can make the judgment result of relaxing monotonicity more accurate.

[0063] Considering equations (1) and (2), we can define relaxed monotonicity through equation (3):

[0064]

[0065] Specifically, the vectorized representation index follows relaxed monotonicity if there exists such a traversal step s, that is, all traversal steps t after traversal step s exceed the value given by R q The defined target vector represents the target region of q.

[0066] In some implementations, the relaxed monotonicity can be checked by comparing the first reference distance described above (in this example, the radius 311) with the second reference distance (e.g., the median distance 331). As an example, the relaxed monotonicity check (also called relaxed monotonicity judgment) can be performed by formula (4):

[0067]

[0068] Specifically, if the second reference distance Exceeding the first reference distance R q , then the relaxed monotonicity condition is satisfied. This means that the second phase of traversal begins here.

[0069] Several examples of performing relaxed monotonicity check are described above using equations (3) and (4) as examples. It should be understood that in some implementations, other methods besides equations (3) and (4) may be used to perform relaxed monotonicity check, and the implementation of the present disclosure is not limited in this respect.

[0070] By performing a relaxed monotonicity check, it is possible to determine whether the traversal process has entered the second stage. This allows the traversal process to be terminated in advance, thereby completing the traversal and obtaining the query results as early as possible while ensuring accuracy.

[0071] Next, we will combine Figure 4 An example architecture 400 for performing traversal queries on vectorized representations based on relaxed monotonicity checks is described.

[0072] Example Architecture

[0073] Figure 4 An example architecture 400 for querying vectorized representations according to some implementations of the present disclosure is shown. In general, the architecture 400 includes an indexing system 410, an index scanning module 420, and a post-processing module such as a sorting module 440.

[0074] Indexing system 410 may be configured to maintain Figure 1The index of each vectorized representation 122 in the vectorized representation set 120. The index system 410 can also be configured to traverse each vectorized representation 122 based on the traversal algorithm 411. The index system 410 can transmit the currently traversed vectorized representation 412 (referred to as the current vectorized representation 412) or its information to the index scanning module 420.

[0075] In the current traversal step, the index scan module 420 can perform a relaxed monotonicity check 422 based on the vectorized representation within the traversal step window (also referred to as the traversal window or the scan window) of the current vectorized representation 412. For example, the traversal step window can be a window of size w that includes at least the current vectorized representation 412. w represents the number of vectorized representations in the traversal step window, which is a natural number greater than or equal to 1. As an example, the index scan module 420 can use a formula such as (3) to perform a relaxed monotonicity check 422. Specifically, the first reference distance can be determined based on the corresponding distance between the candidate vectorized representation determined in the previous traversal step and the target vectorized representation. For example, R can be determined according to formula (1): q As the first reference distance. The second reference distance can be determined based on the corresponding distance between the vectorized representation traversed in the most recent traversal steps in the traversal step window and the target vectorized representation. For example, it can be determined according to formula (2): as the second reference distance.

[0076] As an example and without any limitation, in order to perform the relaxed monotonicity check 411, the architecture 400 can use two queues to track the current traversal state. Specifically, a queue of size E (also called a priority queue or a minimum queue) can be used to maintain the E candidate vectorized representations that are closest to the target vectorized representation visited during the traversal process. Another queue of size w (also called a recent queue) can be used to maintain the w vectorized representations that were recently visited. These two queues can be updated as the traversal process proceeds.

[0077] The current vectorized representation 412 or its information may be provided to the sorting module 440. The sorting module 440 determines whether to perform an update to the candidate set 442. For example, if the number of candidate vectorized representations in the candidate set 442 does not reach a predetermined number (e.g., K), the current vectorized representation 412 may be added to the candidate set 442. If the number of candidate vectorized representations in the candidate set 442 has reached a predetermined number, it may be determined whether to update the candidate set 442 based on the respective candidate vectorized representations and the corresponding distances between the current vectorized representation 442 and the target vectorized representation. Specifically, if the distance between the current vectorized representation 442 and the target vectorized representation is less than the distance between at least one candidate vectorized representation and the target vectorized representation, the current vectorized representation 442 may be added to the candidate set 442, while the candidate vectorized representation with the largest distance from the target vectorized representation in the original candidate vectorized representation is removed from the candidate set 442. In other words, the sorting module 440 may retain only the predetermined number of candidate vectorized representations with the smallest distance after sorting as the candidate set 442.

[0078] Additionally, the result of the relaxed monotonicity check 422 can be provided to the sorting module 440 for termination check 444 to determine whether to terminate the traversal process. In addition to the result of the relaxed monotonicity check 422, other additional conditions may also be considered when performing the termination check 444, such as the original termination condition (if any) of the traversal algorithm 411. When the relaxed monotonicity check 422 passes (referring to satisfying formula (3)) and the original termination condition is satisfied, the sorting module 440 may determine to terminate the current traversal process. The sorting module 440 may select the top K (TopK) from the candidate set 442, such as the K vectorized representations with the smallest distance, and output them as the query result 132.

[0079] In the illustrated example, the relaxed monotonicity check 422 is implemented in the index scan module 420. Figure 4 In the illustrated architecture 400, in each traversal step, the vectorized representation currently traversed is returned, and a relaxed monotonicity check is performed. Compared to the traditional index traversal process, in which the index system can only return K results at a time, performing a relaxed monotonicity check in each traversal step can control the traversal process to terminate in time, which is conducive to terminating the traversal process as early as possible, thereby improving query efficiency.

[0080] Several examples of searching based on the architecture 400 will be described below for different types of indexes.

[0081] In one example, the traversal algorithm 411 of the indexing system 410 can use a graph-based vector index to determine the vectorized representation to be traversed during the traversal process. The graph-based vector index includes a hierarchical proximity graph, in which the upper graph stores coarse-grained samples of the lower graph. Approximate neighboring points found in the upper graph can be used as traversal entries for the lower graph. In such an example, the candidate set 442 can take the form of a priority queue.

[0082] For such a graph-based vector index, the traversal algorithm 411 may employ, for example, a best-first (BF) graph traversal from a fixed starting point. The BF search maintains an ordered candidate set 422 (e.g., an ordered priority queue) of size ef. The candidate set 422 may define, for example, Figure 3 The neighborhood spherical region 310 is shown, and there are ef vectorized representations in the region. For graph-based vector indexing, the number E of vectorized representations in the candidate set 422 may be equal to ef.

[0083] BF traversal explores the index graph through the vectorized representations in the candidate set 422, and expands the exploration range by visiting its neighbor nodes. If a neighbor node has not been visited and its distance from the target vectorized representation q is less than the farthest vectorized representation in the candidate set 422 sorted by the sorting module 440 (in some examples, its distance from q is the neighborhood radius, i.e., the first reference distance), then the traversal will replace the farthest vectorized representation with the vectorized representation corresponding to the neighbor node. The candidate vectorized representation set will be reordered by the sorting module 440. In this example, the size w of the traversal window can be equal to 1.

[0084] In the example of traversing a graph-based vector index, only the relevant states required for the index traversal algorithm can be retained. The relevant states may include a bitmap that records the vectorized representations that have been traversed or visited before, the vectorized representation that is currently being visited, and the vectorized representation to be visited next. These relevant states will be maintained during the life cycle of the query. In order to start a query for an index of a vectorized representation, the electronic device 110 can call an open (Open) function or interface to search the high-level graph. During the query execution process, each call to the next (Next) function will return the current nearest unvisited node. Record the current best unvisited node and expand its neighbors to the untraversed vectorized representations in the relevant state. The relevant state will be cleared in the close (Close) function.

[0085] In another example, the traversal algorithm 411 in the indexing system 410 can use a vector index based on clustering or partitioning to determine the vectorized representation to be traversed. In a cluster-based vector index, each vectorized representation in the vectorized representation set 120 can be divided into different clusters, where adjacent vectorized representations are clustered into one cluster. For this cluster-based vector index, the traversal algorithm 411 can traverse the vectorized representations in a fixed number m clusters closest to the target vectorized representation (K, m are any natural numbers). During the traversal process, if after traversing the vectorized representations in the m clusters, the relaxed monotonicity check 422 such as formula (3) is passed, the traversal process can be terminated. In this example, the number E of vectorized representations in the candidate set 422 can be set to the number K of vectorized representations in the query result in the TopK query, and the size w of the traversal window can be set to the total number of vectorized representations in the m clusters.

[0086] Exemplarily, the cluster-based vector index can cluster the vectorized representations into lists and select the center point as the representative point of each list. In the Open interface for starting the index traversal, the architecture 400 can sort all the lists from near to far according to the distance between the target vectorized representation and the center point. When Next is called, the vectorized representations in the corresponding nearest list are read one by one. The query execution state in the cluster-based vector index includes the sorted list and the current read position, which will be destroyed by the Close interface.

[0087] In another example, the traversal algorithm 411 of the index system 410 can use a traditional index with strict monotonicity, such as a scalar index. This index can be regarded as a special example of relaxing monotonicity. In this example, the number of candidate vectorized representations E and the size w of the traversal window are both set to 1, and equation (3) is always satisfied.

[0088] It should be understood that the types of indexes and the index traversal algorithm 411 described above are merely exemplary and not restrictive. The number of candidate vectorized representations, the size of the traversal window, etc. described above can be continuously adjusted during the traversal process. In some scenarios, using a larger number of candidate vectorized representations and the size of the traversal window can improve the accuracy of the query result 132, but it takes relatively more time. Using a smaller number of candidate vectorized representations and the size of the traversal window can reduce latency, but may reduce accuracy. Therefore, the accuracy requirements and latency requirements can be weighed to select an appropriate number of candidate vectorized representations and the size of the traversal window.

[0089] Several examples of queries that are vectorized based on relaxed monotonicity are described above. However, it should be understood that the various components of architecture 400 are merely exemplary and are not intended to be limiting. Depending on the specific query scenario, architecture 400 may include additional modules or the modules shown therein may be changed. Figure 4 As mentioned above, in some implementations, the query request may also indicate a filtering condition. The filtering condition may be an additional condition such as scalar attribute information. For example, as mentioned above, in the example of product search, the query request may also indicate the price of the product as a filtering condition. In such an implementation, the architecture 400 may also include a filtering module 430.

[0090] The filtering module 430 can be configured to determine whether the vectorized representation currently being traversed (e.g., the current vectorized representation 412) satisfies the filtering condition indicated by the query request. If the current vectorized representation 412 satisfies the filtering condition, the filtering module 430 can provide the current vectorized representation 412 to the sorting module 440 for it to perform an update decision on the candidate set 442. Conversely, if the current vectorized representation 412 does not satisfy the filtering condition, the current vectorized representation 412 will not be used to update the candidate set 442. Depending on the specific implementation and query scenario, in some implementations, the current vectorized representation 412 may not be provided to the sorting module 440, and the next traversal step of the traversal process may be started. In some implementations, a termination check 444 may be performed, and the next traversal step may be started if the traversal process is not terminated.

[0091] In addition, the sorting performed by the sorting module 440 shown in the architecture 400 is only an example of post-processing. In some implementations, the sorting performed by the sorting module 440 can be replaced by other processing or can be omitted according to the query scenario. However, it should be understood that the candidate set 442 and the termination check 444 can be retained. For example, for the similarity filtering scenario mentioned above, the sorting can be omitted.

[0092] Several examples of querying vectorized representations based on relaxed monotonicity are described above in conjunction with example architecture 400. Each of the above examples can be implemented separately or in combination in any appropriate manner. By adopting these query schemes based on relaxed monotonicity, traversal and query results can be completed as early as possible while ensuring accuracy. In this way, the query efficiency for vectorized representation is advantageously improved.

[0093] Example multi-index vectorized representation query

[0094] As mentioned above, in some implementations, the vectorized representation may have vector components corresponding to multiple indexes, respectively. For example, the target vectorized representation includes multiple vector components corresponding to multiple attributes or modes, respectively. The vectorized representations in the vectorized representation set may also include multiple vector components corresponding to these attributes or modes, respectively. For such multi-indexed vectorized representations, each vector component may have a corresponding vector index. That is, multiple vector indices corresponding to different attributes or modes may point to the same vectorized representation.

[0095] As briefly mentioned above, for queries with multi-index vectorized representations, conventional query solutions are difficult to obtain satisfactory query results and often take a long time. Specifically, in order to support multi-index vectorized representation queries, conventional query systems based on TopK can only perform multi-column scans based on multiple columns of sorted vectorized representations collected by TopK, where each column corresponds to an index. If no candidate vectorized representation can meet the requirements of each index after multi-column scanning, the K value used by TopK will be increased, for example, doubled. Multi-column TopK queries are performed again for the increased K value until the multi-column scan results collected for a certain K can simultaneously meet the requirements of each index. This query method of continuously increasing the K value will cause a large delay and is difficult to meet the requirements, especially the delay requirements of online applications.

[0096] In this conventional query scheme, the vector indexes of the vector components of each index are traversed in a non-random access (NRA) manner such as round-robin. Since the vector indexes of different indexes of the same vectorized representation may return results of different similarity qualities, if the candidate results obtained by a TopK query on a column have poor similarity results in another index, returning the result for subsequent calculation will cause unnecessary waste of resources.

[0097] In this regard, in some implementations of the present disclosure, multi-index vectorized representation queries are further optimized to improve the query efficiency for multi-index vectorized representations. According to such an implementation, local queries and global queries are comprehensively considered to make traversal decisions. For example, the traversal process can be divided into multiple traversal rounds. In a round, each index is used for index traversal decision at least once. Each round maintains a local candidate set (also called a local candidate set), which is used to store the query results of the previous round, such as the various vectorized representations accessed or traversed in the previous round. This local candidate set can be used to determine which vector index is more likely to return better results so that it can be accessed more in the next round. In addition, in order to avoid falling into local optimization, a global candidate set can also be stored and updated after each traversal round, which is similar to the candidate set 442 described above. In this way, by comprehensively considering the local candidate set and the global candidate set, it is possible to enable higher-quality vector indexes to be traversed more times, while lower-quality vector indexes will also be traversed.

[0098] Figure 5 Schematic diagram of an example architecture 500 for querying vectorized representations of multiple indices according to some implementations of the present disclosure is shown. The example architecture 500 can be implemented by the electronic device 110. In general, the example architecture 500 includes a traversal decision module 510 and a termination check 530 (which can be viewed as Figure 4 4. The vector components of the plurality of indices of the vectorized representation may have vector index (1) 502, vector index (2) 504, ..., vector index (m) 506, respectively. Each vector index (1) 502, vector index (2) 504, ..., vector index (m) 506 may be respectively based on, for example, Figure 4 The traversal algorithm 411 adopted by the index system 410 in is traversed.

[0099] In some implementations, the traversal decision module 510 may be configured to determine a target index from a plurality of indexes in the current traversal step, that is, to determine which of the vector index (1) 502, the vector index (2) 504, ..., the vector index (m) 506 to use. The traversal decision module 510 may also be configured to select a traversed vectorized representation in the current traversal step from the vectorized representation set 120 according to the target index.

[0100] In some implementations, the traversal decision module 510 may select a target index based on the importance of each index. For example, each index or the probability of an index being selected may be set based on the importance. In the current traversal step, selection is made based on the set probability, for example, by random number generation. As an example, for tasks such as item query, the vectorized representation of each candidate item may have vector components such as an image, a description document, and the like. If a user may want to query a query result that better matches the visual features of the item, the probability of the visual index (corresponding to the image) being selected may be set to be higher than the probability of the semantic index (corresponding to the description document) being selected.

[0101] In some implementations, the traversal process may include multiple traversal rounds. In each traversal round, a vectorized representation to be traversed may be selected at least once based on each of the multiple indexes. As an example, if there are two target indexes and the corresponding indexes are used in a 2:1 ratio, the first target index is used to select the vectorized representation to be traversed 2 times in one round, and the second target index is used to select the vectorized representation to be traversed 1 time. In this example of traversal in rounds, the traversal decision module 510 may select the target index based on the traversal results of the previous traversal round.

[0102] In some implementations, the traversal decision module 510 may store a local candidate set 514, which includes vectorized representations traversed in previous rounds (e.g., the most recent one or more rounds). The traversal decision module 510 may also include a score generator 512, which is configured to determine the corresponding scores of multiple indexes based on the corresponding distances between the vectorized representations traversed in previous rounds stored in the local candidate set 514 (also referred to as local candidate vectorized representations) and the target vectorized representation on multiple indexes for the current round including the current traversal step. As an example, for a certain index, the score of the index can be determined based on the corresponding distances (e.g., average or weighted average) between the vector components of the local candidate vectorized representation corresponding to the index and the vector components of the target vectorized representation corresponding to the index.

[0103] Based on the corresponding scores of the multiple indexes, the traversal decision module 510 can determine the corresponding times of the multiple indexes in the current round, and the number of each index indicates how many traversal steps in the current round the vectorized representation to be traversed is selected according to the index. Based on the corresponding times of the multiple indexes, the traversal decision module 510 can select a target index from the multiple indexes. As an example, in one round, the number of times corresponding to a certain index can be expressed by formula (5):

[0104]

[0105] Where W iIndicates the number of times index i is used for index traversal in this round, n 2 represents the predetermined hyperparameter, avg i represents the score of index i, avg j Represents the corresponding score of index j, j is a positive integer from 1 to m, and m is the number of multiple indexes. That is, the ratio of the number of times these indexes are used in a round can be determined by formula (5). Although "score" is used in the above description, "score" is not necessary, but is used to characterize the distance between the traversed vectorized representation and the target vectorized representation. Therefore, in some implementations, the number of times these indexes correspond respectively can be determined based on the distance.

[0106] As described above, after determining the target index, the traversal decision module 510 can select the traversed vectorized representation in the current traversal step from the vectorized representation set according to the target index. Taking the selected target index corresponding to vector index (2) 504 as an example, the traversal decision module 510 can select the vectorized representation to be traversed currently according to vector index (2) 504.

[0107] In the case where the traversed vectorized representation is determined by the traversal decision module 510, the distance between the traversed vectorized representation and the target vectorized representation can be determined by the score generator 412 or by other modules. Specifically, for each index in the plurality of indexes, the distance component between the vector component of the traversed vectorized representation corresponding to the index and the vector component of the target vectorized representation corresponding to the index can be determined. Further, based on the distance components respectively determined for the plurality of indexes and the corresponding weights of the plurality of indexes, the distance between the traversed vectorized representation and the target vectorized representation is determined.

[0108] In some implementations, the corresponding weights of multiple indexes can be pre-set. For example, the weights of each index can be pre-set according to the importance of each index. In some implementations, the corresponding weights of these indexes can be set according to the corresponding scores of these indexes determined by the score generator 412. For example, indexes with high scores will be set with higher weights. In other words, in this implementation, the weight of an index corresponds to the number of times it is used in a round.

[0109] In the case where the distance between the traversed vectorized representation and the target vectorized representation is determined, the traversal decision module 510 can output the traversed vectorized representation to the global candidate set 520. If the number of candidate vectorized representations in the global candidate set 520 does not exceed the predetermined candidate number of the global candidate set 520, the vectorized representation will be added to the global candidate set 520. If the global candidate set 520 already includes a predetermined number of global candidate vectorized representations, the distance between the traversed vectorized representation and the target vectorized representation can be compared with the corresponding distance between the global candidate vectorized representation and the target vectorized representation in the global candidate set 520. If the distance of the traversed vectorized representation is less than the distance of a certain global candidate vectorized representation, the global candidate set 520 will be updated. That is, the currently traversed vectorized representation will be added to the global candidate set 520, and the vectorized representation with the lowest ranking (for example, the largest distance from the target vectorized representation) in the original global candidate set 520 will be removed.

[0110] like Figure 5 As shown, the example architecture 500 also includes a relaxed monotonicity check 515 and a termination check 530, which are similar to Figure 4 The relaxed monotonicity check 422 and the termination check 444 are shown. For example, the relaxed monotonicity check 515 can determine whether the relaxed monotonicity is passed based on formula (3) in the current step. The termination check 530 can determine whether to terminate the traversal process based on whether the relaxed monotonicity check is passed and whether the original termination condition (if any) of the traversal algorithm is satisfied. When the relaxed monotonicity check 515 passes (referring to satisfying formula (3)) and the original termination condition is satisfied, the traversal can be terminated. After the traversal is terminated, the query result 132 will be output.

[0111] Combination Figure 5 A query scheme for multi-index vectorized representation is described. By adopting the scheme, query results can be obtained and termination checks can be performed based on the local candidate set and the global candidate set of the current round. In this implementation, it is possible to facilitate finding query results that are as accurate as possible with high efficiency. In this way, the query efficiency for the vectorized representation is advantageously improved.

[0112] It should be understood that in some implementations, the example architecture 400 and the example architecture 500 may be implemented separately or partially in combination. By using the example architectures 400 and 500, different types of vectorized representation queries may be optimized to improve query efficiency.

[0113] Query performance analysis

[0114] The query for vectorized representation based on relaxed monotonicity proposed in the present disclosure can be applied to a variety of query scenarios. Next, the query performance of the conventional query scheme and the query performance of the present scheme will be analyzed by taking the TopK query with filtering conditions as an example.

[0115] First, the performance of the conventional query solution is described. In the conventional query solution, in order to find K vectorized representations that match the filter condition, the conventional TopK-based query system collects K' vectorized representations through TopK(K') and sorts them. K' represents the minimum number of vectorized representations that need to be traversed to obtain TopK. In order to obtain K' vectorized representations, it is necessary to sort the vectors in the range R 1 The vectorized representation is traversed according to the index. The query is then continued on K' vectorized representations by applying filtering conditions and TopK operations to obtain the final query result. The above process of the conventional query scheme can be expressed by formula (6):

[0116] r 1 =Limit_K(Filter(Limit_K'(Sort(R 1 )))) (6)

[0117] Among them, r 1 Indicates the final query result, Limit_K indicates the constraint condition of TopK, Filer indicates the filtering condition, and Sort indicates sorting.

[0118] Taking filter selectivity as the ratio between the output set and the input set of the filtering operation, equation (6) can be expressed as equation (7):

[0119] r 1 =Limit_K″(Filter(Sort(R 1 ))), (7)where K″=min(K, K′×filter_selectivity).

[0120] Assume that a conventional TopK-based system can predict the optimal value, that is, the value that makes Then formula (7) can be simplified to formula (8):

[0121] r 1 =Limit_K(Filter(Sort(R 1 ))). (8)

[0122] Next, we will analyze the query performance of the query solution based on the present disclosure. According to the query solution of the present disclosure, the query is performed on the same index as the TopK system in R2 Range traversal is represented by vectorization, as shown in formula (9):

[0123] r 2 =Limit_K(Sort(Filter(R 2 ))) (9)

[0124] where r 2 Indicates the query result.

[0125] In some implementations, the traversal range R used by the query scheme of the present disclosure is 2 It can be compared with the R used in the conventional TopK-based solution. 1 The same, that is, R 1 =R 2 Comparing equation (8) with equation (9), only the order of filtering and sorting operations is exchanged, so r 1 =r 2 .

[0126] However, in the above analysis, it is assumed that the conventional TopK-based system can predict the optimal That is, However, this is usually difficult to achieve. If K′×filter_selectivity<K, the conventional system cannot obtain sufficient results, making the query results inaccurate. Conversely, if K′×filter_selectivity>K, although more accurate results can be obtained, additional resources will be spent, resulting in greater delays.

[0127] Some conventional TopK-based systems use a method of continuous experimentation until K′×filter_selectivity≥K is satisfied to determine K′, but this method will cause too much repeated data access and processing. In contrast, in the query scheme disclosed in the present invention, the vectorized representation of the traversed data is returned in each traversal step. In other words, according to the scheme disclosed in the present invention, the vectorized representation of the traversed data is determined in real time during the traversal process. Thus, there is no need for such a continuous trial process to make a traversal termination decision. Therefore, the query solution disclosed in the present invention can ensure high accuracy while meeting performance requirements in terms of latency and the like.

[0128] The performance of the query solution disclosed in the present invention and the conventional query solution is analyzed by taking the TopK query with filtering conditions as an example. Next, the range filtering query scenario will be taken as an example for analysis.

[0129] The range filtering query based on TopK can be expressed as formula (10):

[0130] r 1=Filter(Limit_K′(Sort(R 1 ))) (10)

[0131] The meanings of the symbols are the same as above, so they will not be repeated here.

[0132] Similar to equations (6) to (7), equation (10) can be transformed into equation (11) as follows:

[0133] r 1 =Limit_K″(Filter((Sort(R 1 )))) (11)

[0134] Where K″=K′×filter_selectivity.

[0135] Similarly, if we assume that a conventional TopK-based system can predict the optimal value And suppose the query produces T vectorized representations, that is, the value such that based on Then formula (11) can be simplified to formula (12):

[0136] r 1 =Limit_T(Filter(Sort(R1)))=Filter(Sort(R 1 )). (12)

[0137] In contrast, according to the query solution disclosed in the present invention, the query is performed on the same index as the TopK system in R 2 Range traversal vectorized representation, and query result r is obtained 2 , as shown in formula (13):

[0138] r 2 =Filter(R 2 ). (13)

[0139] In some implementations, the traversal range R used by the query scheme of the present disclosure is 2 It can be compared with the R used in the conventional TopK-based solution. 1 The same, that is, R 1 =R 2 Comparing formula (12) with formula (13), since the filtering condition is not sensitive to the sorting order, r 1 =r 2 .

[0140] Example Cost Estimate

[0141] Complex queries often require effective cost estimation for various query plans. Generally speaking, cost estimation includes vector algebra calculations (e.g., distance calculations), selectivity estimation when the query contains filtering, and index scan costs, etc. Traditional query plans, such as traditional databases, use a constant t to estimate the computational cost of scalar data, for example, t = 0.0025 or any other appropriate value. Since vector calculations involve distance calculations between vectors, which is proportional to the dimension, vector calculations are more expensive.

[0142] In some implementations, the cost of vector computation for a vectorized query can be expressed as Equation (14):

[0143] t v (dim) = t·c·dim (14)

[0144] where t v (dim) represents the cost of vector calculation, t represents the cost of scalar operation, t may be a predetermined value, c represents a coefficient related to optimization such as single instruction multiple data (SIMD) for vector calculation, and dim represents the dimension of vectorized representation.

[0145] In some implementations, if the query request contains a filter condition, the query can estimate the selectivity. That is, the proportion of elements that pass the filter condition can be estimated. As an example, the distribution of high-dimensional vectorized representations can be measured based on a sampling method. Specifically, the vectorized representation data can be uniformly sampled at a certain ratio, and the sampled vectorized representations can be stored in the metadata of a database (e.g., a vectorized representation set). Given a query request q, it applies filtering on the sampled data to estimate the selectivity Sel on the entire vectorized representation data set, as shown in formula (15):

[0146] Sel sample (q)≈Sel full_data (q) (15)

[0147] Among them, Sel sample (q) represents the selectivity of the sampled data for query request q, Sel full_data (q) represents the selectivity over all data. In some implementations, the selectivity can be estimated by adjusting the sampling rate to obtain a smaller delay.

[0148] In some implementations, an index scan cost can be estimated. The index scan cost includes a startup cost and a traversal cost. The startup cost is the cost of locating the area near the target vectorized representation before returning the vectorized representation data. The traversal cost represents the cost of traversing the matching elements through the index. For each index traversal step, the cost C step IncludedIO and t v (dim), that is, C step =t v (dim)+t IO , where t IO represents the input and output (IO) cost of obtaining index data from storage devices (such as hard disks), t v (dim) represents the cost of calculating the distance.

[0149] For a cluster-based index, the index scan cost C p It can be expressed by formula (16):

[0150]

[0151] Among them, N represents the table size, N c represents the number of cluster centers, N p denotes the average number of vectorized representations in each cluster, and m denotes the number of clusters that the index traversal algorithm needs to traverse for the relaxed monotonicity check.

[0152] For a graph-based index, the index scan cost C g It can be expressed by formula (17):

[0153] C g =N star t×C step +max(Sel(q)N,N E )×R iter ×C step (17) Where N start Indicates the number of steps to traverse the upper graph in the Open function, N E represents the number of steps required to satisfy the relaxed monotonicity check, and R iter Indicates the average number of times the distance function is called in each step to reach the next node. N start 、N E and R iter It can depend on the data distribution and hyperparameters related to the index. The data distribution and hyperparameters can be automatically estimated during the sampling process.

[0154] By using the calculation methods listed above, the various costs in the query process of vectorized representation can be determined, thereby performing query planning.

[0155] Example Process

[0156] Figure 6 FIG. 6 is a flowchart of a process 600 for querying vectorized representations according to some implementations of the present disclosure. The process 600 may be implemented in Figure 1The electronic device 110 is located at the electronic device 110.

[0157] At block 610, the electronic device 110 receives a query request for a set of vectorized representations. The query request indicates a target vectorized representation.

[0158] In block 620, the electronic device 110 performs the process of blocks 622 to 626 in the current query step of the query process for the vectorized representation set. Specifically, in block 622, the electronic device 110 determines a first reference distance based on the corresponding first distances between the candidate vectorized representation and the target vectorized representation. The candidate vectorized representation is determined from the vectorized representation set in the previous query step of the query process. In some implementations, the electronic device 110 may determine the maximum distance among the corresponding first distances as the first reference distance.

[0159] In box 624, the electronic device 110 determines a second reference distance based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step. In some implementations, the electronic device 110 may determine a corresponding second distance between the vectorized representation queried in the query step window including the current query step and the target vectorized representation. The electronic device 110 may determine the second reference distance based on the corresponding second distance. In some implementations, the electronic device 110 may determine the median distance in the corresponding second distance as the second reference distance.

[0160] At block 626, the electronic device 110 determines whether the query process stops based on at least the second reference distance being greater than the first reference distance. If the electronic device 110 determines at block 626 that the query process does not stop, the electronic device 110 continues to perform the next query step of the query process. If the electronic device 110 determines at block 626 that the query process stops, the process 600 proceeds to block 630. At block 630, the electronic device 110 determines a query result for the target vectorized representation based on the candidate vectorized representation.

[0161] In some implementations, the target vectorized representation includes multiple vector components corresponding to multiple indexes, and the vectorized representations in the vectorized representation set include multiple vector components corresponding to the multiple indexes. In such an implementation, box 620 may also include additional boxes. For example, in the current query step, the electronic device 110 may determine the target index from the multiple indexes; and may select the queried vectorized representation in the current query step from the vectorized representation set based on the target index.

[0162] In some implementations, the query process includes multiple query rounds. In each query round of the multiple query rounds, the vectorized representation to be queried is selected at least once according to each index in the multiple indexes. In such an implementation, process 600 may also include, for the current round of the current query step, based on the corresponding number of multiple indexes, wherein the number of each index indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round, that is, selecting the vectorized representation to be queried according to the index in the multiple query steps of the current round. In such an implementation, determining the target index from the multiple indexes may include: selecting the target index from the multiple indexes based on the corresponding number of multiple indexes.

[0163] In some implementations, process 600 also includes: determining, for each index among multiple indexes, a distance component between a vector component of a queried vectorized representation corresponding to the index and a vector component of a target vectorized representation corresponding to the index; and determining the distance between the queried vectorized representation and the target vectorized representation based on the distance components determined respectively for the multiple indexes and the corresponding weights of the multiple indexes.

[0164] In some implementations, the query request also indicates a filtering condition, and process 600 also includes: determining whether the queried vectorized representation satisfies the filtering condition in the current query step; and in response to the filtering condition being satisfied, determining whether to perform an update on the candidate set, the candidate set including the candidate vectorized representation.

[0165] Example Device

[0166] Figure 7 A schematic block diagram of an electronic device capable of implementing multiple implementations of the present disclosure is shown. It should be understood that Figure 7 The electronic device 700 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the implementations described in the present disclosure.

[0167] like Figure 7 As shown, the electronic device 700 includes an electronic device in the form of a general purpose computing device 700. The components of the electronic device 700 may include, but are not limited to, one or more processors or processing units 710, a memory 720, a storage device 730, one or more communication units 740, one or more input devices 750, and one or more output devices 760.

[0168] In some implementations, the electronic device 700 may be implemented as a computing device, a computing system, a server, a mainframe, or other device having computing capabilities.

[0169] The processing unit 710 may be an actual or virtual processor and may be capable of performing various processes according to a program stored in the memory 720. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the electronic device 700. The processing unit 710 may include a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor, a controller, and / or a microcontroller, etc. The processing device 110 may be the same as or different from the processing unit 710.

[0170] The electronic device 700 typically includes a plurality of computer storage media. Such media can be any available media accessible to the electronic device 700, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 720 can include volatile memory (e.g., registers, caches, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory) or some combination thereof. The storage device 730 can include removable or non-removable media, and can include computer-readable media, such as memory, flash drive, disk or any other media, which can be used to store information and / or data and can be accessed within the electronic device 700.

[0171] The electronic device 700 may further include additional removable / non-removable, volatile / non-volatile storage media. Figure 7 As shown in , a disk drive for reading or writing from a removable, nonvolatile disk and an optical drive for reading or writing from a removable, nonvolatile optical disk can be provided. In these cases, each drive can be connected to a bus (not shown) by one or more data media interfaces.

[0172] The communication unit 740 implements communication with another computing device through a communication medium. Additionally, the functions of the components of the electronic device 700 can be implemented with a single computing cluster or multiple computing machines that can communicate through a communication connection. Therefore, the electronic device 700 can operate in a networked environment using a logical connection with one or more other servers, a personal computer (PC), or another general network node.

[0173] The input device 750 may be one or more various input devices, such as a mouse, a keyboard, a data import device, etc. The output device 760 may be one or more output devices, such as a display, a data export device, etc. The electronic device 700 may also communicate with one or more external devices (not shown) through the communication unit 740 as needed, such as a storage device, a display device, etc., communicate with one or more devices that allow a user to interact with the electronic device 700, or communicate with any device that allows the electronic device 700 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0174] In some implementations, in addition to being integrated on a single device, some or all of the various components of the electronic device 700 can also be set in the form of a cloud computing architecture. In a cloud computing architecture, these components can be remotely arranged and can work together to implement the functions described in the present disclosure. In some implementations, cloud computing provides computing, software, data access and storage services, which do not require end users to know the physical location or configuration of the system or hardware that provides these services. In various implementations, cloud computing uses appropriate protocols to provide services through a wide area network (such as the Internet). For example, a cloud computing provider provides applications through a wide area network, and they can be accessed through a web browser or any other computing component. The software or components of the cloud computing architecture and the corresponding data can be stored on a server at a remote location. The computing resources in a cloud computing environment can be merged at a remote data center location or they can be dispersed. Cloud computing infrastructure can provide services through a shared data center, even if they appear as a single access point for users. Therefore, the components and functions described herein can be provided from a service provider at a remote location using a cloud computing architecture. Alternatively, they can be provided from a conventional server, or they can be installed directly or otherwise on a client device.

[0175] The electronic device 700 may be used to implement various implementations of the present disclosure. The memory 720 may include one or more modules having one or more program instructions, which may be accessed and executed by the processing unit 610 to implement the functions of various implementations described herein. For example, the memory 720 may include a vectorized representation query module 725 for querying the target vectorized representation indicated by the query request. Figure 7 As shown, the electronic device 700 can obtain the input required for the query through the input device 750, and can provide the query output through the output device 760. In some implementations, the electronic device 700 can also receive input from other devices (not shown) via the communication unit 740.

[0176] Example Implementation

[0177] Some implementations of the present disclosure are listed below.

[0178] In one aspect, the present disclosure provides a computer-implemented method. The method includes: receiving a query request for a set of vectorized representations, the query request indicating a target vectorized representation; in a current query step of a query process for the set of vectorized representations, determining a first reference distance based on a corresponding first distance between a candidate vectorized representation and a target vectorized representation, the candidate vectorized representation being determined from the set of vectorized representations in a previous query step of the query process; determining a second reference distance based at least on a distance between the queried vectorized representation and the target vectorized representation in the current query step; determining that the query process is stopped based at least on the second reference distance being greater than the first reference distance; and in response to the query process being stopped, determining a query result for the target vectorized representation based on the candidate vectorized representation.

[0179] In some implementations, determining the second reference distance includes: determining a corresponding second distance between a vectorized representation queried in a query step window including a current query step and a target vectorized representation; and determining the second reference distance based on the corresponding second distance.

[0180] In some implementations, determining the second reference distance based on the corresponding second distances includes determining a median distance among the corresponding second distances as the second reference distance.

[0181] In some implementations, determining the first reference distance includes determining a maximum distance among the corresponding first distances as the first reference distance.

[0182] In some implementations, the target vectorized representation includes multiple vector components corresponding to multiple indexes, and the vectorized representations in the vectorized representation set include multiple vector components corresponding to the multiple indexes. In such an example implementation, the method also includes determining a target index from the multiple indexes in the current query step; and selecting the queried vectorized representation in the current query step from the vectorized representation set according to the target index.

[0183] In some implementations, the query process includes multiple query rounds. In each query round of the multiple query rounds, a vectorized representation to be queried is selected at least once according to each index in a plurality of indexes. In such an example implementation, the method further includes, for a current round including a current query step, determining the corresponding number of times of the multiple indexes based on the corresponding distances between the vectorized representation queried in the previous round and the target vectorized representation on the multiple indexes, wherein the number of times of each index in the multiple indexes indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round. In such an example implementation, determining the target index from the multiple indexes may include: selecting the target index from the multiple indexes based on the corresponding number of times of the multiple indexes.

[0184] In some implementations, the method also includes: determining, for each index among multiple indexes, a distance component between a vector component of a queried vectorized representation corresponding to the index and a vector component of a target vectorized representation corresponding to the index; and determining the distance between the queried vectorized representation and the target vectorized representation based on the distance components determined respectively for the multiple indexes and the corresponding weights of the multiple indexes.

[0185] In some implementations, the query request also indicates a filtering condition, and the method further includes: determining whether the queried vectorized representation in the current query step satisfies the filtering condition; and in response to the filtering condition being satisfied, determining whether to perform an update to a candidate set, the candidate set including the candidate vectorized representation.

[0186] On the other hand, the present disclosure provides an electronic device. The electronic device includes: a processor; and a memory, coupled to the processor and containing instructions stored thereon, the instructions causing the device to perform the following actions when executed by the processor, the actions including: receiving a query request for a vectorized representation set, the query request indicating a target vectorized representation; in a current query step of a query process for the vectorized representation set, determining a first reference distance based on a corresponding first distance between a candidate vectorized representation in a candidate set and a target vectorized representation, the candidate vectorized representation being determined from the vectorized representation set in a previous query step of the query process; determining a second reference distance based at least on a distance between the queried vectorized representation and the target vectorized representation in the current query step; determining whether the query process is stopped based at least on whether the second reference distance is greater than the first reference distance; and in response to the query process stopping, determining a query result for the target vectorized representation based on the candidate set.

[0187] In some implementations, determining the second reference distance includes: determining a corresponding second distance between a vectorized representation queried in a query step window including a current query step and a target vectorized representation; and determining the second reference distance based on the corresponding second distance.

[0188] In some implementations, determining the second reference distance based on the corresponding second distances includes: determining a median distance among the corresponding second distances as the second reference distance.

[0189] In some implementations, determining the first reference distance includes determining a maximum distance among the corresponding first distances as the first reference distance.

[0190] In some implementations, the target vectorized representation includes multiple vector components corresponding to multiple indexes, respectively, and the vectorized representations in the vectorized representation set include multiple vector components corresponding to the multiple indexes, respectively, and the action also includes: in the current query step, determining the target index from the multiple indexes; and selecting the queried vectorized representation in the current query step from the vectorized representation set based on the target index.

[0191] In some implementations, the query process includes multiple query rounds, in each of the multiple query rounds, the vectorized representation to be queried is selected at least once according to each index in a plurality of indexes, and the action also includes: for a current round including a current query step, based on the corresponding distances between the vectorized representation queried in a previous round and the target vectorized representation on the plurality of indexes, determining the corresponding number of times of the plurality of indexes, wherein the number of each index in the plurality of indexes indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round, and wherein determining the target index from the plurality of indexes includes: selecting the target index from the plurality of indexes based on the corresponding number of times of the plurality of indexes.

[0192] In some implementations, the action also includes: determining, for each index among multiple indexes, a distance component between a vector component of a queried vectorized representation corresponding to the index and a vector component of a target vectorized representation corresponding to the index; and determining the distance between the queried vectorized representation and the target vectorized representation based on the distance components determined respectively for the multiple indexes and the corresponding weights of the multiple indexes.

[0193] In some implementations, the query request also indicates a filtering condition, and the action also includes: determining whether the queried vectorized representation in the current query step satisfies the filtering condition; and in response to the filtering condition being satisfied, determining whether to perform an update to a candidate set, the candidate set including the candidate vectorized representation.

[0194] On the other hand, the present disclosure provides a computer program product, which is tangibly stored in a computer storage medium and includes computer executable instructions, which, when executed by a device, cause the device to perform the following actions, the actions including: receiving a query request for a set of vectorized representations, the query request indicating a target vectorized representation; determining a first reference distance in a current query step of a query process for the set of vectorized representations based on corresponding first distances between candidate vectorized representations in a candidate set and the target vectorized representation, the candidate vectorized representation being determined from the set of vectorized representations in a previous query step of the query process; determining a second reference distance based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step; determining whether the query process is stopped based at least on whether the second reference distance is greater than the first reference distance; and determining a query result for the target vectorized representation based on the candidate set in response to the query process stopping.

[0195] In some implementations, determining the second reference distance includes: determining a corresponding second distance between a vectorized representation queried in a query step window including a current query step and a target vectorized representation; and determining the second reference distance based on the corresponding second distance.

[0196] In some implementations, determining the second reference distance based on the corresponding second distances includes: determining a median distance among the corresponding second distances as the second reference distance.

[0197] In some implementations, determining the first reference distance includes determining a maximum distance among the corresponding first distances as the first reference distance.

[0198] In some implementations, the target vectorized representation includes multiple vector components corresponding to multiple indexes, respectively, and the vectorized representations in the vectorized representation set include multiple vector components corresponding to the multiple indexes, respectively, and the action also includes: in the current query step, determining the target index from the multiple indexes; and selecting the queried vectorized representation in the current query step from the vectorized representation set based on the target index.

[0199] In some implementations, the query process includes multiple query rounds, in each of the multiple query rounds, the vectorized representation to be queried is selected at least once according to each index in a plurality of indexes, and the action also includes: for a current round including a current query step, based on the corresponding distances between the vectorized representation queried in a previous round and the target vectorized representation on the plurality of indexes, determining the corresponding number of times of the plurality of indexes, wherein the number of each index in the plurality of indexes indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round, and wherein determining the target index from the plurality of indexes includes: selecting the target index from the plurality of indexes based on the corresponding number of times of the plurality of indexes.

[0200] In some implementations, the action also includes: determining, for each index among multiple indexes, a distance component between a vector component of a queried vectorized representation corresponding to the index and a vector component of a target vectorized representation corresponding to the index; and determining the distance between the queried vectorized representation and the target vectorized representation based on the distance components determined respectively for the multiple indexes and the corresponding weights of the multiple indexes.

[0201] In some implementations, the query request also indicates a filtering condition, and the action also includes: determining whether the queried vectorized representation satisfies the filtering condition in the current query step; and in response to the filtering condition being satisfied, determining whether to perform an update to a candidate set, the candidate set including the candidate vectorized representation.

[0202] In yet another aspect, the present disclosure provides a computer-readable medium having computer-executable instructions stored thereon, which, when executed by a device, cause the device to perform one or more example implementations of the method of the above aspects.

[0203] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, example types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), load programmable logic devices (CPLDs), and the like.

[0204] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0205] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0206] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain the desired result. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a separate implementation can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination.

[0207] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A computer-implemented method comprising: Receiving a query request for a set of vectorized representations, the query request indicating a target vectorized representation; In the current query step of the query process for the vectorized representation set, determining a first reference distance based on a corresponding first distance between a candidate vectorized representation and the target vectorized representation, the candidate vectorized representation being determined from the set of vectorized representations in a previous query step of the query process; Determining a second reference distance based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step; At least based on the second reference distance being greater than the first reference distance, determining that the query process stops; as well as In response to the query process stopping, a query result for the target vectorized representation is determined based on the candidate vectorized representation.

2. The method according to claim 1, wherein determining the second reference distance comprises: determining a corresponding second distance between the vectorized representation queried in a query step window including the current query step and the target vectorized representation; as well as The second reference distance is determined based on the corresponding second distance.

3. The method of claim 2, wherein determining the second reference distance based on the corresponding second distance comprises: A median distance among the corresponding second distances is determined as the second reference distance.

4. The method of claim 1 , wherein determining the first reference distance comprises: A maximum distance among the corresponding first distances is determined as the first reference distance.

5. The method according to claim 1, wherein the target vectorized representation comprises a plurality of vector components respectively corresponding to a plurality of indexes, and the vectorized representations in the vectorized representation set comprise a plurality of vector components respectively corresponding to the plurality of indexes, and the method further comprises: In the current query step, determining a target index from the multiple indexes; as well as The queried vectorized representation in the current query step is selected from the vectorized representation set according to the target index.

6. The method according to claim 5, wherein the query process comprises a plurality of query rounds, in each of the plurality of query rounds, the vectorized representation to be queried is selected at least once according to each index in the plurality of indexes, and the method further comprises: For a current round including the current query step, determining corresponding times of the plurality of indexes based on corresponding distances between the vectorized representation queried in the previous round and the target vectorized representation on the plurality of indexes, wherein the time of each index in the plurality of indexes indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round, and Wherein determining the target index from the multiple indexes comprises: The target index is selected from the plurality of indexes based on the corresponding times of the plurality of indexes.

7. The method according to claim 5, further comprising: For each index of the plurality of indexes, determining a distance component between a vector component of the queried vectorized representation corresponding to the index and a vector component of the target vectorized representation corresponding to the index; as well as Based on the distance components respectively determined for the plurality of indexes and corresponding weights of the plurality of indexes, a distance between the queried vectorized representation and the target vectorized representation is determined.

8. The method according to claim 1, wherein the query request further indicates a filtering condition, and the method further comprises: Determining in the current query step whether the queried vectorized representation satisfies the filtering condition; as well as In response to the filtering condition being satisfied, it is determined whether to perform an update on a candidate set, the candidate set including the candidate vectorized representation.

9. An electronic device, comprising: Processing unit; as well as a memory coupled to the processing unit and containing instructions stored thereon, the instructions, when executed by the processing unit, causing the device to perform the following actions, the actions comprising: Receiving a query request for a set of vectorized representations, the query request indicating a target vectorized representation; In the current query step of the query process for the vectorized representation set, determining a first reference distance based on a corresponding first distance between a candidate vectorized representation and the target vectorized representation, the candidate vectorized representation being determined from the set of vectorized representations in a previous query step of the query process; Determining a second reference distance based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step; At least based on the second reference distance being greater than the first reference distance, Determining that the query process stops; and In response to the query process stopping, a query result for the target vectorized representation is determined based on the candidate vectorized representation.

10. The electronic device of claim 9, wherein determining the second reference distance comprises: determining a corresponding second distance between the vectorized representation queried in a query step window including the current query step and the target vectorized representation; as well as The second reference distance is determined based on the corresponding second distance.

11. The electronic device of claim 10, wherein determining the second reference distance based on the corresponding second distance comprises: A median distance among the corresponding second distances is determined as the second reference distance.

12. The electronic device of claim 9, wherein determining the first reference distance comprises: A maximum distance among the corresponding first distances is determined as the first reference distance.

13. The electronic device according to claim 9, wherein the target vectorized representation includes a plurality of vector components respectively corresponding to a plurality of indexes, and the vectorized representations in the vectorized representation set include a plurality of vector components respectively corresponding to the plurality of indexes, and the actions further include: In the current query step, determining a target index from the multiple indexes; as well as The queried vectorized representation in the current query step is selected from the vectorized representation set according to the target index.

14. The electronic device according to claim 13, wherein the query process comprises a plurality of query rounds, in each of the plurality of query rounds, the vectorized representation to be queried is selected at least once according to each index in the plurality of indexes, and the action further comprises: For a current round including the current query step, determining corresponding times of the plurality of indexes based on corresponding distances between the vectorized representation queried in the previous round and the target vectorized representation on the plurality of indexes, wherein the time of each index in the plurality of indexes indicates the number of query steps for selecting the vectorized representation to be queried according to the index in the current round, and Wherein determining the target index from the multiple indexes comprises: The target index is selected from the plurality of indexes based on the corresponding times of the plurality of indexes.

15. The electronic device according to claim 13, wherein the actions further comprise: For each index of the plurality of indexes, determining a distance component between a vector component of the queried vectorized representation corresponding to the index and a vector component of the target vectorized representation corresponding to the index; as well as Based on the distance components respectively determined for the plurality of indexes and corresponding weights of the plurality of indexes, a distance between the queried vectorized representation and the target vectorized representation is determined.

16. The electronic device according to claim 9, wherein the query request further indicates a filtering condition, and the action further comprises: Determining in the current query step whether the queried vectorized representation satisfies the filtering condition; as well as In response to the filtering condition being satisfied, it is determined whether to perform an update on a candidate set, the candidate set including the candidate vectorized representation.

17. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions which, when executed by a device, cause the device to perform the following actions, the actions comprising: Receiving a query request for a set of vectorized representations, the query request indicating a target vectorized representation; In the current query step of the query process for the vectorized representation set, determining a first reference distance based on corresponding first distances between candidate vectorized representations in a candidate set and the target vectorized representation, the candidate vectorized representations being determined from the set of vectorized representations in a previous query step of the query process; Determining a second reference distance based at least on the distance between the queried vectorized representation and the target vectorized representation in the current query step; At least based on the second reference distance being greater than the first reference distance, determining that the query process stops; as well as In response to the query process stopping, a query result for the target vectorized representation is determined based on the candidate vectorized representation.

18. The computer program product of claim 17, wherein determining the second reference distance comprises: determining a corresponding second distance between the vectorized representation queried in a query step window including the current query step and the target vectorized representation; as well as The second reference distance is determined based on the corresponding second distance.

19. The computer program product of claim 18, wherein determining the second reference distance based on the corresponding second distance comprises: A median distance among the corresponding second distances is determined as the second reference distance.

20. The computer program product of claim 17, wherein the target vectorized representation comprises a plurality of vector components respectively corresponding to a plurality of indices, and the vectorized representations in the set of vectorized representations comprise a plurality of vector components respectively corresponding to the plurality of indices, and the actions further comprise: In the current query step, determining a target index from the multiple indexes; as well as The queried vectorized representation in the current query step is selected from the vectorized representation set according to the target index.

Citation Information

Cited By

  • Method and apparatus for querying vector data, and device and storage medium

    WO2025236857A1