WO2025014686A1 - Query for vectorized representations - Google Patents

Query for vectorized representations Download PDF

Info

Publication number
WO2025014686A1
WO2025014686A1 PCT/US2024/036472 US2024036472W WO2025014686A1 WO 2025014686 A1 WO2025014686 A1 WO 2025014686A1 US 2024036472 W US2024036472 W US 2024036472W WO 2025014686 A1 WO2025014686 A1 WO 2025014686A1
Authority
WO
WIPO (PCT)
Prior art keywords
vectorized
query
vectorized representation
target
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/US2024/036472
Other languages
French (fr)
Inventor
Qianxi ZHANG
Shuotao XU
Qi Chen
Guoxin SUI
Yuqing Yang
Fan Yang
Mao YANG
Lidong Zhou
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Microsoft Technology Licensing LLC
Original Assignee
Microsoft Technology Licensing LLC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Microsoft Technology Licensing LLC filed Critical Microsoft Technology Licensing LLC
Publication of WO2025014686A1 publication Critical patent/WO2025014686A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3347Query execution using vector based model
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • G06F16/287Visualization; Browsing

Definitions

  • Query services may usually find a result that match a query target from a database or a data set.
  • Query services are crucial for applications such as a search engine, e-commerce, and a recommendation system.
  • various types of data may be mapped to high-dimensional vectors.
  • Such vectors are also referred to as vectorized representations.
  • deep learning technology may be used to perform feature extraction on object data such as an image, audio, video, and text and/or the like to obtain high-dimensional vectorized representations of these objects.
  • a scheme for vectorized query is proposed.
  • a query request for a vectorized representation set is received.
  • the query request indicates a target vectorized representation.
  • a first reference distance is determined based on respective first distances between candidate vectorized representations and the target vectorized representation.
  • the candidate vectorized representations are determined from the vectorized representation set in a previous query step of the query process.
  • a second reference distance is determined based at least on a distance between a queried vectorized representation in the current query step and the target vectorized representation. It is determined that the query process is terminated based at least on the second reference distance being larger than the first reference distance.
  • a query result for the target vectorized representation is determined based on the candidate vectorized representations.
  • Fig. 1 shows a block diagram of an example environment in which multiple implementations of the present disclosure can be implemented; [0007] Fig. 2A and Fig. 2B show a traversal result of a vectorized representation set respectively; [0008] Fig. 3 shows a schematic diagram of relaxed monotonicity traversed by vectorized representations according to some implementations of the present disclosure; [0009] Fig.
  • FIG. 4 shows a schematic diagram of an example architecture for querying vectorized representations according to some implementations of the present disclosure
  • Fig. 5 shows a schematic diagram of an example architecture for querying vectorized representations with multi-attribute vector components according to some implementations of the present disclosure
  • Fig. 6 shows a flowchart of a process for querying vectorized representations according to some implementations of the present disclosure
  • Fig. 7 shows a schematic block diagram of an electronic device capable of implement multiple implementations of the present disclosure.
  • the term “includes” and its variants are to be read as open-ended terms that mean “includes, but is not limited to.”
  • the term “based on” is to be read as “based at least in part on.”
  • the term “one example embodiment” and “an example embodiment” are to be read as “at least one example embodiment.”
  • the term “one example embodiment” and “an embodiment” are to be read as “at least one example embodiment.”
  • the term “another embodiment” is to be read as “at least one further embodiment.”
  • the term “first,” “second” or the like can represent different or the same objects.
  • model may learn a correlation between a corresponding input and output from training data, so that a corresponding output may be generated for a given input after a training is completed. Model generation may be based on machine learning technology. Deep learning is a machine learning algorithm that uses multiple layers of processing units to process input and provide corresponding output.
  • a neural network model is an example of a deep learning-based model.
  • a “model” may also be referred to as a “machine learning model”, a “learning model”, a “machine learning network”, or a “learning network”, and these terms are used interchangeably in this article.
  • pairs of terms about “query” and “traversal” including the terms “query process” and “traversal process”, the terms “query step” and “traversal step”, and the terms “queried vector representation” and “traversed vector representation” and the like may be used interchangeably.
  • Fig. 1 shows a schematic diagram of an example environment 100 in which the implementation of the present disclosure can be implemented.
  • an electronic device 110 receives a query request 102.
  • the query request 102 may be input by a user via an input device.
  • 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 devices may determine the indicated target vectorized representation 112 according to the received query request 102.
  • the target vectorized representation 112 may be a vectorized representation of the image.
  • the target vectorized representation 112 may also be referred to as a query vector, but this is only exemplary and not intended make any limitation.
  • the electronic device 110 determines a query result 132 for the query request 102 from a vectorized representation set 120.
  • the electronic device 110 may search for vectorized representations similar to a target vectorized representation 122 from the vectorized representation set, and then determine the query result 132 based on images corresponding to these vectorized representations.
  • the electronic device 110 may communicate with a database storing the 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).
  • the vectorized representation 122-1, the vectorized representation 122-2, ..., the vectorized representation 122-N herein may be referred to individually as a “vectorized representation 122” or collectively as “a set of vectorized representations 122”.
  • the electronic device 110 may select candidate vectorized representations that match the query request 102 from the set of vectorized representations 122 and determine the query result 132 based on the candidate vectorized representations.
  • the vectorized representation may refer to a representation of any suitable type of object in a form of one or more vectors.
  • objects may be various types of data information, such as text, images, audio, video, recipes, and so on, or may be various types of entities, including but are not limited to people, organizations, items, and so on.
  • vectorized representation and “vector” herein may be used interchangeably.
  • the vectorized representation may be a feature representation of an object extracted using the deep learning technology, for example, a feature representation of an image or text.
  • the vectorized representation may be a data item organized in a form of vector, for example, a row or a column of a data table.
  • each row in the data table of a product corresponds to a product, and respective columns represent data from multiple dimensions of the product (for example, price, manufacturer, sales volume, and so on).
  • the vectorized representation may be a row of data in such a data table.
  • the vectorized representations may include one or more vector components (sometimes may also be referred to as vectors). Each vector component may correspond to an attribute, a modality, or the like.
  • each vector component may have a respective index.
  • the vectorized representation may include a vector component corresponding to a single index.
  • the vectorized representation may include a vector component of a vision-only attribute (or referred to as an image modality), or a vector component of a semantics-only attribute (or referred to as a text modality), and so on.
  • the vectorized representation may include multiple vector components corresponding to multiple indices. Each index may be associated with an attribute or a modality.
  • a vectorized representation of a recipe may include two vector components corresponding to two indices, that is, a vector component representing images of dishes and a vector component representing text of a dish-making process.
  • the vectorized representation may further be associated with a scalar attribute.
  • each vectorized representation corresponds to a product and is associated with data such as price and sales volume for the product.
  • the query for vectorized representations shown in Fig. 1 may be used in a variety of applications, such as embedding-based retrieval, facial recognition, code retrieval, question answering applications, multi search, redundancy detection, and so on. In these various applications, different query scenarios may exist. Several examples of query scenarios for vectorized representations are listed below. [0025] In an example scenario of query, the query may be for a single attribute or modality.
  • the vectorized representation may include a vector component of a single attribute or may only consider a single attribute.
  • the electronic device 110 may determine one or more (for example, K, where K is an arbitrary natural number) vectorized representations 122 closest to the target vectorized representation 112 as the query result 132.
  • K an arbitrary natural number
  • Such a query may also be referred to as a TopK query for a single vector column, or a single vector TopK query.
  • Such a query may usually be applied to embedded-based retrieval, recommender systems, or question answering systems.
  • additional information such as scalar attribute information, may be considered during the query process.
  • the query request 102 may further indicate a filter condition.
  • the target vectorized representation 112 may be a vectorized representation of a product image, and the query request 102 may further indicate a filter condition about product prices.
  • the electronic device 110 may search for one or more vectorized representations 122 that meet a scalar attribute information constraint and are closest to the target vectorized representation 112 as the query result 132. Such a search for vectorized representations may also be referred to as a single vector TopK query with scalar attribute filtering. Such a query may be applied to applications such as multi-query. [0027] In another example scenario of query, the query may be for multiple attributes or modalities.
  • the vectorized representations may have vector components corresponding to these attributes or modalities, respectively.
  • a cross-result of multiple TopK searches for different attributes may be determined as the query result 132.
  • Such multi-attribute comprehensive query is also referred to as a multi-column TopK query or a multi-attribute TopK query.
  • Such a multi-column TopK query may improve result quality of query applications such as question answering applications.
  • similarity filtering may be applied to a query for vectorized representations.
  • the electronic device 110 may search for vectorized representations that have a similarity to the target vectorized representation 112 greater than a similarity threshold from the vectorized representation set 120. For example, in facial recognition, faces similar to a target face are found from a database.
  • Such a scenario of query is also referred to as vector similarity filtering.
  • Several example scenarios for a query of vectorized representations are described above, but they are only exemplary. The implementations of the present disclosure are not limited to these query scenarios. Other scenarios of query are also possible, for example, JOIN queries. In addition, combinations of any two or more scenarios of query are also possible.
  • online applications that apply queries for vectorized representations usually have a strict latency requirement. For example, users using online applications usually expect feedback in a very short time. Latency of such applications is usually required to be within a few milliseconds. In this way, online applications may provide real-time query results to users, thereby improving user experience.
  • the electronic device 110 determines the query result 132 for the query request 102 are described above. In the environment 100, the electronic device 110 may be any type of device with computing power, including a terminal device or a server device.
  • the terminal device may be any type of mobile terminals, fixed terminals, or portable terminals, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, personal communication system (PCS) devices, personal navigation devices, personal digital assistant (PDA), audio/video players, digital cameras/video cameras, positioning devices, television receivers, radio broadcast receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
  • the server devices may 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.
  • KNN K-Nearest Neighbor
  • Centroids of respective clusters are compared with the query vector, thereby determining one or more clusters that are relatively adjacent.
  • One or more clusters are searched to obtain K vectors that are relatively matched.
  • respective vectors in the database are used as nodes of the graph, and a degree of difference between different vectors is determined as a distance between respective nodes. In this way, nodes of respective vectors in respective databases are connected into a relational graph.
  • an entry node for the query may be selected randomly. A distance between a 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 K approximate vectors are determined.
  • the implementations of the present disclosure provide a query scheme for vectorized representations. According to the implementations of the present disclosure, the vectorized representation set is traversed for the query request indicating the target vectorized representation.
  • candidate vectorized representations are determined from the vectorized representation set as at least a portion of the candidate set in a previous query step of the query process.
  • a first reference distance is determined based on respective distances between candidate vectorized representations and the target vectorized representation. For example, the maximum distance among these distances may be determined as the first reference distance.
  • a second reference distance is determined at least based on a second distance between the current queried vectorized representation and the target vectorized representation. It is determined that whether the query process is terminated at least according to the comparison of these two reference distances. If the query process is terminated, the query result for the target vectorized representation is determined based on the candidate set.
  • comparisons of the two reference distances may indicate a current trend of the query process, that is, indicate 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 may be terminated. According to the implementations of the present disclosure, additional index query termination condition check is introduced without modifying the underlying index traversal logic. The search may be completed and the query result may be obtained as early as possible while ensuring the accuracy. In this way, the query efficiency for vectorized representations is improved advantageously. [0041] The example embodiments of the present disclosure are described below with reference to the accompanying drawings.
  • Figs. 2A and 2B show traversal results 200 and 250 for the vectorized representation set, respectively. In the example of Fig. 2A, clustering-based vector indices are used for traversal.
  • FIG. 2B graph-based vector indices are used for traversal.
  • multiple traversal experiments are performed using the TopK query as an example.
  • Figs. 2A and 2B show the traversal results 200 and 250, respectively.
  • the traversal results 200 and 250 show distances between the traversed vectors and the query vector at different steps of traversal, respectively.
  • this manner of traversing by vector indices does not follow monotonicity. As the traversal process progresses, the distances between the traversed vectors and the query vector fluctuate unpredictably.
  • both of these traversal results 200 and 250 show similar two-phase traversal patterns.
  • a dashed line 210 also referred to as a first phase of the traversal
  • the index traversal approaches a target area where the query result is located continuously.
  • the index traversal stabilizes gradually and deviates from the target area gradually.
  • Fig.2B shows a similar two-phase traversal pattern indicated by a dashed line 260.
  • the inventor used different types of vector indices to analyze queries of vectorized representations for various databases, all of which showed similar traversal patterns.
  • the query result usually may not be found in the second phase of the traversal. If a step of traversing to the second phase may be found, the traversal may be ended early, thereby speeding up the determination process of the query result.
  • relaxed monotonicity is proposed in the implementations of the present disclosure.
  • the order in which respective vectorized representations are traversed by index is shown by a trajectory 320 which is shown by the dashed arrow in the figure, that is, the traversal is in the order of a vectorized representation 322, a vectorized representation 324, a vectorized representation 326, ....
  • the traversal is in the order of a vectorized representation 322, a vectorized representation 324, a vectorized representation 326, ....
  • to determine whether to enter the second phase of the traversal it is necessary to determine the range of an adjacent area for the target vectorized representation for the query request.
  • a range of spherical area is described as an example, where a spherical area 310 represents an adjacent area of a target vectorized representation 301, which is also referred to as the target area.
  • the query result for the target vectorized representation 301 may be located within the area 310.
  • the area 310 has a radius 311 which is also referred to as the first reference distance. It should be understood that in some implementations, the target area may also have a shape other than sphere. [0050] In the current traversal step s, the first reference distance, that is, the radius 311, may be determined according to results of a previous traversal.
  • the radius 311 may be obtained by Equation (1): (1) where q represents target represents ⁇ represents the vectorized representation traversed in the ⁇ ⁇ step, j is less than the current steps to be traversed s, ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ , ⁇ ⁇ ⁇ represents a distance between the vectorized representation traversed in the ⁇ ⁇ step and the target vectorized representation 301, TopE represents E vectorized representations closest to q (or referred to as most similar to q) in the vectorized representations traversed before the current traversal step s, and Max represents the maximum value.
  • the maximum distance among the E vectorized representations (also referred to as candidate vectorized representations) traversed before the current traversal step s is determined as the first reference distance, that is, the radius 311.
  • the radius 311 may be determined by averaging, weighted averaging, or other appropriate operations on the respective distances of the E candidate vectorized representations.
  • 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 regard.
  • the target vectorized representation may be located in the target area or range in the vector space.
  • the current index traversal position needs to be considered, which may represent the distance between the current traversed vectorized representation and the target vectorized representation or may represent the distance between a most recent traversed vectorized representation and the target vectorized representation.
  • the second reference distance may be determined based at least on the distance between the current traversed vectorized representation and the target vectorized representation. The second reference distance corresponds to all current traversal positions.
  • the current index traversal position may represent the distance between the vectorized representation traversed in the current traversal step and the target vectorized representation.
  • the distance between the current traversed vectorized representation and the target vectorized representation may be determined as the second reference distance.
  • the current index traversal position may represent respective distances between a plurality of vectorized representations within the current traversal window (including the most recent traversal steps, also referred to as a traversal step window or a scan window) and the target vectorized representation.
  • the second reference distance may be determined based on respective distances (also referred to as the second distance) between a plurality of vectorized representations within a traversal window 340 and the target vectorized representation.
  • 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, the traversal window may include a single vectorized representation, that is, the length of the traversal window may be 1. [0055] In some implementations, the second reference distance may be determined by averaging, weighted averaging, or other appropriate operations on respective 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.
  • a median distance of the respective distances between these vectorized representations and the target vectorized representation may be determined as the second reference distance.
  • the second reference distance may be expressed as Equation (2): (2) , ⁇ the vectorized representation in the traversal window 340, ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ ⁇ , ⁇ ⁇ represents a distance between the vectorized representation ⁇ and the target vectorized representation 301, and Median represents the median distance.
  • outlier vectorized representations in the traversal window for example, vectorized representations 342 and 346, may be discarded.
  • the distances between these outlier vectorized representations and the target vectorized representation are too large or too small compared to other vectorized representations in the traversal window 340, which may easily cause a deviation in the determined result of the second reference distance.
  • the judgment result of relaxed monotonicity may be more accurate by using the median distance as the second reference distance.
  • relaxed monotonicity may be defined by Equation (3): (3) where specifically, if a s, indices follow relaxed monotonicity, that is, all traversal steps t after the traversal step s exceed the target area of the target vectorized representation q defined by ⁇ ⁇ .
  • relaxed monotonicity may be checked by comparing the aforementioned first reference distance (in this example, the radius 311) with the second reference distance (for example, a median distance 331).
  • a relaxed monotonicity check also referred to as a relaxed monotonicity judgment
  • Equation (4) (4) where specifically, if the second ⁇ ⁇ , the relaxed monotonicity condition is satisfied.
  • Fig. 4 shows the example architecture 400 for querying vectorized representations according to some implementations of the present disclosure.
  • the architecture 400 includes an indexing system 410, an index scanning module 420, and a post-processing module such as a sorting module 440.
  • the indexing system 410 may be configured to maintain indices of respective vectorized representations 122, such as in the vectorized representation set 120 of Fig. 1.
  • the indexing system 410 may further be configured to traverse respective vectorized representations 122 based on a traversal algorithm 411.
  • the indexing system 410 may transmit a current traversed vectorized representation 412 (referred to as a current vectorized representation 412 in short) or its information to the index scanning module 420.
  • the index scanning module 420 may perform a relaxed monotonicity check 422 based on vectorized representations within a traversal step window (also referred to as a traversal window or a scanning window) of the current vectorized representation 412.
  • the traversal step window may be a window with a 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.
  • the index scanning module 420 may perform the relaxed monotonicity check 422 using Equation (3).
  • the first reference distance may be determined based on respective distances between candidate vectorized representations determined in a previous traversal step and the target vectorized representation.
  • the first reference distance may be determined as ⁇ ⁇ according to Equation (1).
  • the second reference distance may be determined based on respective distances between vectorized representations traversed in the most recent traversal steps in the traversal step window and the target vectorized representation.
  • the second reference distance may be determined as ⁇ ⁇ ⁇ according to Equation (2).
  • two queues may be used in the architecture 400 to track the current traversal state.
  • a queue of size E also referred to as a priority queue or a minimum queue
  • E may be used to maintain E candidate vectorized representations closest to the target vectorized representation visited during the traversal process.
  • Another queue of size w (also referred to as a most recent queue) may be used to maintain w vectorized representations visited recently. These two queues may be updated as the traversal process progresses.
  • 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 on a candidate set 442. For example, if the number of candidate vectorized representations in the candidate set 442 does not reach a predetermined number (for example, K), the current vectorized representation 412 may be added to the candidate set 442.
  • whether to update the candidate set 442 may be determined based on the respective distances between respective candidate vectorized representations and the current vectorized representations 412 and the target vectorized representation. Specifically, if the distance between the current vectorized representation 412 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 412 may be added to the candidate set 442, and the candidate vectorized representation with the largest distance from the target vectorized representation in the original candidate vectorized representations may be removed from the candidate set 442. In other words, the sorting module 440 may only retain a predetermined number of candidate vectorized representations with the minimum distance after sorting as the candidate set 442.
  • the result of the relaxed monotonicity check 422 may be provided to the sorting module 440 for a termination check 444, thereby determining whether to terminate the traversal process.
  • the execution of the termination check 444 may also consider other additional conditions, for example, the original termination condition of the traversal algorithm 411 (if any).
  • the sorting module 440 may determine to terminate the current traversal process.
  • the sorting module 440 may select top K (TopK) vectorized representations, for example, K vectorized representations with the minimum distance, from the candidate set 442, and output them as the query result 132.
  • the relaxed monotonicity check 422 is implemented in the index scanning module 420.
  • the architecture 400 shown in Fig. 4 in each traversal step, vectorized representations of the current traversal are returned and the relaxed monotonicity check is performed.
  • performing the relaxed monotonicity check in each traversal step may control the timely termination of the traversal process, which is conducive to terminating the traversal process as early as possible, thereby improving query efficiency.
  • search based on the architecture 400 will be described for different types of indices.
  • the traversal algorithm 411 of the indexing system 410 may employ a graph-based vector index to determine vectorized representations to be traversed during the traversal.
  • the graph-based vector index includes a hierarchical neighborhood graph where the upper-layer graph keeps coarse-grained samples of the lower-layer graph. The approximate nearest point found in the upper-layer graph may serve as the traversal entry point of the lower-layer graph.
  • the candidate set 442 may use the form of a priority queue.
  • the traversal algorithm 411 may use, such as a best-first (BF) graph traversal from a fixed starting point.
  • BF best-first
  • BF search maintains a sorted candidate set 442 (for example, a sorted priority queue) with the size of ef.
  • the candidate set 442 may define the neighborhood spherical area 310, such as that shown in Fig. 3, in which there are ef vectorized representations.
  • the number E of vectorized representations in the candidate set 442 may be equal to ef.
  • BF traversal explores the index graph through vectorized representations in the candidate set 442 and expands the exploration range by visiting its neighbor nodes.
  • the traversal will replace the farthest vectorized representation with the vectorized representation corresponding to the neighbor node.
  • the candidate vectorized representation set will be resorted by the sorting module 440.
  • the size w of the traversal window may be equal to 1.
  • the traversal algorithm 411 in the indexing system 410 may employ a clustering-based or partition-based vector index to determine vectorized representations to be traversed.
  • clustering-based vector index respective vectorized representations in the vectorized representation set 120 may be divided into different clusters, where adjacent vectorized representations are clustered into one cluster.
  • the traversal algorithm 411 may traverse vectorized representations in a fixed number of m clusters closest to the target vectorized representation (K, m are any natural number).
  • K, m are any natural number
  • the query execution state in the clustering-based vector index includes sorted lists and the current read position, which will be destroyed by a Close interface.
  • the traversal algorithm 411 of the indexing system 410 may employ a conventional index with strict monotonicity, for example, a scalar index. Such an index may be regarded as a special example of relaxed monotonicity.
  • the number of candidate vectorized representations E and the size of the traversal window w are both set to 1, and Equation (3) is always satisfied.
  • Equation (3) is always satisfied.
  • the architecture 400 may include additional modules or the modules shown therein may be changed.
  • the query request may further indicate a filter condition.
  • the filter condition may be an additional condition such as scalar attribute information.
  • the query request may further indicate product price as a filter condition.
  • the architecture 400 may further include a filtering module 430. [0080]
  • the filtering module 430 may be configured to determine whether the current traversed vectorized representation (for example, the current vectorized representation 412) satisfies the filter condition indicated by the query request.
  • the filtering module 430 may 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 filter condition, the current vectorized representation 412 may not be used to update the candidate set 442.
  • 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, the termination check 444 may be performed and the next traversal step may be started while the traversal process is not terminated.
  • TopK-based conventional query systems may only perform multi-column scan according to multiple columns of sorted vectorized representations collected by TopK, where each column corresponds to an index. If there is no candidate vectorized representation meets the requirements of respective indices after the multi-column scan, the value K used by TopK will be increased, for example, by double.
  • Multi-column TopK queries may be re-executed for the increased value K until the multi-column scan results collected for a certain K may meet the requirements of respective indices at the same time.
  • Such a query method of increasing the value K continuously may cause longer latency, which is difficult to meet the requirements, especially the latency requirement of online applications.
  • vector indices of vector components of each index are traversed in no random access (NRA) manners such as round-robin and so on. Because vector indices of different indices of the same vectorized representation may return results with different similarity qualities, if candidate results obtained through a certain column TopK query have poor similarity results in a further index aspect, then returning the results for subsequent computations will cause unnecessary resource waste.
  • NUA no random access
  • Fig. 5 shows a schematic diagram of an example architecture 500 for querying vectorized representations of multi-index in accordance with some implementations of the present disclosure.
  • the example architecture 500 may be implemented by the electronic device 110.
  • the example architecture 500 includes a traversal decision module 510 and a termination check 530 (which may be regarded as an example of the termination check 444 in Fig. 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 traversed according to the traversal algorithm 411 adopted by the indexing system 410, such as in Fig. 4, respectively.
  • the traversal decision module 510 may be configured to determine a target index from a plurality of indices 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 further be configured to select a traversed vectorized representation from the vectorized representation set 120 in the current traversal step according to the target index.
  • the traversal decision module 510 may select the target index according to the importance of each index. For example, the probability of each index or indices being selected may be set according to the importance. In the current traversal step, selection is made according to the set probability, for example, by a manner of generating random numbers.
  • the vectorized representation of each candidate item may have vector components such as an image, a description document, and the like.
  • the traversal process may include a plurality of traversal rounds.
  • a vectorized representation to be traversed may be selected according to each index of the plurality of indices at least once. As an example, if there are two target indices and respective indices are used in a ratio of 2:1, a first target index is used to select the vectorized representation to be traversed twice in one round, and a second target index is used to select the vectorized representation to be traversed once.
  • the traversal decision module 510 may select the target index according to traversal results of a previous traversal round.
  • the traversal decision module 510 may store a local candidate set 514 that includes vectorized representations traversed in the previous round (for example, the most recent round or rounds).
  • the traversal decision module 510 may further include a score generator 512 configured to determine, for a current round including the current traversal step, respective scores for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation traversed in a previous round stored in the local candidate set 514 (also referred to as the local candidate vectorized representations) and the target vectorized representation.
  • a score for the index may be determined based on respective distances (for example, an average or an weighted average) between vector components of the index corresponding to the local candidate vectorized representation and a vector component of the index corresponding to the target vectorized representation.
  • the traversal decision module 510 may determine respective times for the plurality of indices in the current round, and a time for each index indicates the number of traversal steps for which a vectorized representation to be traversed is selected in the current round. Based on the respective times for the plurality of indices, the traversal decision module 510 may select the target index from the plurality of indices.
  • times corresponding to some index may be represented by Equation (5): (5) where ⁇ ⁇ represents ⁇ ⁇ a predetermined hyper-parameter, ⁇ ⁇ ⁇ ⁇ represents the score of index i, ⁇ ⁇ ⁇ ⁇ represents a respective score of index j, j is a positive integer from 1 to m, and m is the number of the plurality of indices. That is, the proportion of times that these indices are used in a round may be determined by Equation (5).
  • “score” is used in the above description, “score” is not essential, is used to characterize a distance between the traversed vectorized representation and the target vectorized representation.
  • a distance component between a vector component of the traversed vectorized representation corresponding to the index and a vector component of the target vectorized representation corresponding to the index may be determined. Further, based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices, a distance between the traversed vectorized representation and the target vectorized representation is determined. [0095]
  • the respective weights of the plurality of indices may be preset. For example, weights of respective indices may be preset according to the importance of the respective indices. In some implementations, respective weights of these indices may be set according to respective scores determined by the score generator 512.
  • the traversal decision module 510 may output the traversed vectorized representation to a global candidate set 520. If the number of candidate vectorized representations in the global candidate set 520 does not exceed a predetermined candidate number of the global candidate set 520, the vectorized representation will be added to the global candidate set 520.
  • the distance between the traversed vectorized representation and the target vectorized representation will be compared with respective distances between the global candidate vectorized representations in the global candidate set 520 and the target vectorized representation. If the distance of the traversed vectorized representation is smaller than some distance of the global candidate vectorized representations, the global candidate set 520 will be updated. That is, the current traversed vectorized representation will be added to the global candidate set 520, and the vectorized representation with the lowest order (for example, with the largest distance from the target vectorized representation) in the original global candidate set 520 will be removed. [0097] As shown in Fig.
  • the example architecture 500 further includes a relaxed monotonicity check 515 and the termination check 530, which are similar to the relaxed monotonicity check 422 and the termination check 444 shown in Fig. 4, respectively.
  • the relaxed monotonicity check 515 may determine whether relaxed monotonicity is passed based on Equation (3) in the current step.
  • the termination check 530 may determine whether to terminate the traversal process according to whether relaxed monotonicity check is passed and whether the original termination condition (if any) of the traversal algorithm is satisfied. In a case where the relaxed monotonicity check 515 is passed (referring to the satisfaction of Equation (3)) and the original termination condition is satisfied, the traversal may be terminated. After the traversal is terminated, the query result 132 will be output.
  • the cost of vector computation for vectorized representation query may be represented as Equation (14): (14) where represents scalar operation, t may be a such as single instruction multiple data (SIMD) for vector computation, and dim represents the dimension of vectorized representation.
  • SIMD single instruction multiple data
  • the query may estimate selectivity. That is, the ratio of elements that may pass the filter condition may be estimated.
  • sampling-based methods may be used to measure the distribution of high-dimensional vectorized representations.
  • the vectorized representation data may be uniformly sampled at a certain ratio, and the sampled vectorized representations are s tored in the metadata of the database (for example, the vectorized representation set).
  • the filter Given a query request q, it applies the filter on the sampled data to estimate the selectivity Sel on the full vectorized representation dataset, as shown in Equation (15): where represents on query request q, and the selectivity on the full data.
  • selectivity by adjusting the sampling rate to obtain shorter latency.
  • index scan cost may be estimated.
  • the index scan cost includes start-up cost and traversal cost.
  • Start-up cost is the cost to locate the region nearby the target vectorized representation before returning vectorized representation data.
  • Traversal cost represents the cost to traverse the matched elements through the index.
  • each drive may be connected to a bus (not shown) via one or more data medium interfaces.
  • the communication unit 740 communicates with a further electronic device via a communication medium.
  • the functions of components in the electronic device 700 may be implemented by a single computing cluster or a plurality of computing machines that can communicate via communication connections. Therefore, the electronic device 700 can operate in a networked environment using a logical connection with one or more other servers, personal computers (PCs) or other general network nodes.
  • some or all components of the electronic device 700 may also be arranged in the form of a cloud computing architecture.
  • the components may be provided remotely and work together to implement the functions described in the subject matter described herein.
  • cloud computing provides computing, software, data access and storage services, which will not require end users to be aware of the physical locations or configurations of the systems or hardware providing these services.
  • the cloud computing provides the services via a wide area network (such as Internet) using proper protocols.
  • a cloud computing provider provides applications over the wide region network, which can be accessed through a web browser or any other computing components.
  • the software or components of the cloud computing architecture and respective data may be stored on a server at a remote location.
  • the computing resources in the cloud computing environment may be merged at locations of remote data centers or may be distributed.
  • Cloud computing infrastructures may provide the services through a shared data center, though they behave as a single access point for users. Therefore, the cloud computing architecture may be used to provide the components and functions described herein from a service provider at a remote location. Alternatively, they may be provided from a conventional server or installed directly or otherwise on a client device.
  • the electronic device 700 may be used to implement multiple implementations of the present disclosure.
  • the memory 720 may include one or more modules having one or more program instructions. These modules can be accessed and executed by the processing unit 710 to perform functions of various implementations described herein.
  • the method comprises: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations.
  • determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances.
  • determining the second reference distance based on the respective second distances comprises: determining a median distance of the respective second distances as the second reference distance.
  • determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance.
  • the method further comprises: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index.
  • determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices.
  • the method further comprises: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices.
  • the electronic device comprises: a processing unit; and a memory coupled to the processing unit and comprising instructions stored thereon, the instructions, when executed by the processing unit, causing the device to perform acts comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations.
  • the query request further indicates a filter condition
  • the acts further comprise: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations.
  • the query request further indicates a filter condition
  • the acts further comprise: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations.
  • a computer-readable medium is provided by the present disclosure.
  • the computer-readable medium has machine-executable instructions stored thereon which, when executed by a device, cause the device to perform one or more example implementations of the methods of the aforementioned aspects.
  • the functionality described herein can be performed, at least in part, by one or more hardware logic components.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

According to the implementations of the present disclosure, a solution for querying for vectorized representation is provided. A query request for a vectorized representation set indicates a target vectorized representation. In a current query step of a query process for the vectorized representation set, a first reference distance is determined based on respective first distances between candidate vectorized representations and the target vectorized representation. A second reference distance is determined based at least on a distance between a queried vectorized representation in the current query step and the target vectorized representation. The query process is determined to be terminated based at least on the second reference distance being larger than the first reference distance. In response to the termination of the query process, a query result for the target vectorized representation is determined based on the candidate vectorized representations.

Description

QUERY FOR VECTORIZED REPRESENTATIONS BACKGROUND [0001] Various query services have been widely used or have application prospects. Query services may usually find a result that match a query target from a database or a data set. Query services are crucial for applications such as a search engine, e-commerce, and a recommendation system. [0002] For example, with the development of deep learning technology, various types of data may be mapped to high-dimensional vectors. Such vectors are also referred to as vectorized representations. For example, deep learning technology may be used to perform feature extraction on object data such as an image, audio, video, and text and/or the like to obtain high-dimensional vectorized representations of these objects. Traditional semantic analysis-based query schemes are difficult to implement queries for vectorized representations of such complex data. In particular, for an online query service, a query result usually needs to be determined in a very short time. This proposes a relatively strict latency requirement for a query for vectorized representations. SUMMARY [0003] According to implementations of the present disclosure, a scheme for vectorized query is proposed. According to this scheme, a query request for a vectorized representation set is received. The query request indicates a target vectorized representation. In a current query step of a query process for the vectorized representation set, a first reference distance is determined based on respective first distances between candidate vectorized representations and the target vectorized representation. The candidate vectorized representations are determined from the vectorized representation set in a previous query step of the query process. A second reference distance is determined based at least on a distance between a queried vectorized representation in the current query step and the target vectorized representation. It is determined that the query process is terminated based at least on the second reference distance being larger than the first reference distance. In response to the termination of the query process, a query result for the target vectorized representation is determined based on the candidate vectorized representations. [0004] According to the disclosed scheme, a query may be completed and a query result may be obtained 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 Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS [0006] Fig. 1 shows a block diagram of an example environment in which multiple implementations of the present disclosure can be implemented; [0007] Fig. 2A and Fig. 2B show a traversal result of a vectorized representation set respectively; [0008] Fig. 3 shows a schematic diagram of relaxed monotonicity traversed by vectorized representations according to some implementations of the present disclosure; [0009] Fig. 4 shows a schematic diagram of an example architecture for querying vectorized representations according to some implementations of the present disclosure; [0010] Fig. 5 shows a schematic diagram of an example architecture for querying vectorized representations with multi-attribute vector components according to some implementations of the present disclosure; [0011] Fig. 6 shows a flowchart of a process for querying vectorized representations according to some implementations of the present disclosure; and [0012] Fig. 7 shows a schematic block diagram of an electronic device capable of implement multiple implementations of the present disclosure. DETAILED DESCRIPTION [0013] The present disclosure will now be described with reference to various example embodiments. It should be appreciated that description of those embodiments is merely to enable those skilled in the art to better understand and further implement the present disclosure and is not intended for limiting the scope disclosed herein in any manner. [0014] As used herein, the term “includes” and its variants are to be read as open-ended terms that mean “includes, but is not limited to.” The term “based on” is to be read as “based at least in part on.” The term “one example embodiment” and “an example embodiment” are to be read as “at least one example embodiment.” The term “one example embodiment” and “an embodiment” are to be read as “at least one example embodiment.” The term “another embodiment” is to be read as “at least one further embodiment.” The term “first,” “second” or the like can represent different or the same objects. Other definitions, either explicit or implicit, may be included below. [0015] It should be noted that the titles of any sections/sub sections provided in this article are not restrictive. This article describes various implementations throughout, and any type of implementation can be included under any section/sub section. In addition, the implementation described in any section/sub section can be combined in any way with any other implementation described in the same section/sub section and/or different sections/sub sections. [0016] As used herein, the term “model” may learn a correlation between a corresponding input and output from training data, so that a corresponding output may be generated for a given input after a training is completed. Model generation may be based on machine learning technology. Deep learning is a machine learning algorithm that uses multiple layers of processing units to process input and provide corresponding output. A neural network model is an example of a deep learning-based model. In this article, a “model” may also be referred to as a “machine learning model”, a “learning model”, a “machine learning network”, or a “learning network”, and these terms are used interchangeably in this article. [0017] As used herein, pairs of terms about “query” and “traversal” including the terms “query process” and “traversal process”, the terms “query step” and “traversal step”, and the terms “queried vector representation” and “traversed vector representation” and the like may be used interchangeably. Although the term “traversal” is used for describing in some implementations, it should be understood that the traversal of the vectorized set is not required to be complete, that is, it is not required that each and every vectorized representation in the vectorized set has been visited. Example Environment [0018] Fig. 1 shows a schematic diagram of an example environment 100 in which the implementation of the present disclosure can be implemented. In the environment 100 of Fig. 1, an electronic device 110 receives a query request 102. For example, the query request 102 may be input by a user via an input device. In 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 devices may determine the indicated target vectorized representation 112 according to 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. Hereinafter, the target vectorized representation 112 may also be referred to as a query vector, but this is only exemplary and not intended make any limitation. [0019] Based on the target vectorized representation 112, the electronic device 110 determines a query result 132 for the query request 102 from a vectorized representation set 120. For example, the electronic device 110 may search for vectorized representations similar to a target vectorized representation 122 from the vectorized representation set, and then determine the query result 132 based on images corresponding to these vectorized representations. [0020] To this end, the electronic device 110 may communicate with a database storing the 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 purposes of explanation, the vectorized representation 122-1, the vectorized representation 122-2, ..., the vectorized representation 122-N herein may be referred to individually as a “vectorized representation 122” or collectively as “a set of vectorized representations 122”. The electronic device 110 may select candidate vectorized representations that match the query request 102 from the set of vectorized representations 122 and determine the query result 132 based on the candidate vectorized representations. The electronic device 110 may then provide the determined query result 132 to a user or to other devices or applications that issue the query request 102. [0021] In the implementations of the present disclosure, the vectorized representation (including the target vectorized representation 112 and the vectorized representation 122 in the vectorized representation set 120) may refer to a representation of any suitable type of object in a form of one or more vectors. Such objects may be various types of data information, such as text, images, audio, video, recipes, and so on, or may be various types of entities, including but are not limited to people, organizations, items, and so on. The terms “vectorized representation” and “vector” herein may be used interchangeably. [0022] In some implementations, the vectorized representation may be a feature representation of an object extracted using the deep learning technology, for example, a feature representation of an image or text. In some implementations, the vectorized representation may be a data item organized in a form of vector, for example, a row or a column of a data table. For example, each row in the data table of a product corresponds to a product, and respective columns represent data from multiple dimensions of the product (for example, price, manufacturer, sales volume, and so on). The vectorized representation may be a row of data in such a data table. [0023] The vectorized representations may include one or more vector components (sometimes may also be referred to as vectors). Each vector component may correspond to an attribute, a modality, or the like. Each vector component may have a respective index. In some implementations, the vectorized representation may include a vector component corresponding to a single index. For example, the vectorized representation may include a vector component of a vision-only attribute (or referred to as an image modality), or a vector component of a semantics-only attribute (or referred to as a text modality), and so on. In some implementations, the vectorized representation may include multiple vector components corresponding to multiple indices. Each index may be associated with an attribute or a modality. For example, a vectorized representation of a recipe may include two vector components corresponding to two indices, that is, a vector component representing images of dishes and a vector component representing text of a dish-making process. In some implementations, the vectorized representation may further be associated with a scalar attribute. For example, each vectorized representation corresponds to a product and is associated with data such as price and sales volume for the product. [0024] Because the vectorized representation may contain a variety of abundant data, the query for vectorized representations shown in Fig. 1 may be used in a variety of applications, such as embedding-based retrieval, facial recognition, code retrieval, question answering applications, multi search, redundancy detection, and so on. In these various applications, different query scenarios may exist. Several examples of query scenarios for vectorized representations are listed below. [0025] In an example scenario of query, the query may be for a single attribute or modality. For example, the vectorized representation may include a vector component of a single attribute or may only consider a single attribute. Accordingly, the electronic device 110 may determine one or more (for example, K, where K is an arbitrary natural number) vectorized representations 122 closest to the target vectorized representation 112 as the query result 132. Such a query may also be referred to as a TopK query for a single vector column, or a single vector TopK query. Such a query may usually be applied to embedded-based retrieval, recommender systems, or question answering systems. [0026] In another example scenario of query, comparing to query for a vectorized representation with a single attribute, additional information, such as scalar attribute information, may be considered during the query process. In this scenario, the query request 102 may further indicate a filter 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 may further indicate a filter condition about product prices. The electronic device 110 may search for one or more vectorized representations 122 that meet a scalar attribute information constraint and are closest to the target vectorized representation 112 as the query result 132. Such a search for vectorized representations may also be referred to as a single vector TopK query with scalar attribute filtering. Such a query may be applied to applications such as multi-query. [0027] In another example scenario of query, the query may be for multiple attributes or modalities. In this case, the vectorized representations may have vector components corresponding to these attributes or modalities, respectively. For such vectorized representations of multiple attributes, a cross-result of multiple TopK searches for different attributes may be determined as the query result 132. Such multi-attribute comprehensive query is also referred to as a multi-column TopK query or a multi-attribute TopK query. Taking recipe retrieval as an example, vector components of two attributes including text of the dish-making process and images of dishes may be searched separately, and results of the two searches may be considered comprehensively, thereby obtaining the query result 132. Such a multi-column TopK query may improve result quality of query applications such as question answering applications. [0028] In yet another example scenario, similarity filtering may be applied to a query for vectorized representations. The electronic device 110 may search for vectorized representations that have a similarity to the target vectorized representation 112 greater than a similarity threshold from the vectorized representation set 120. For example, in facial recognition, faces similar to a target face are found from a database. Such a scenario of query is also referred to as vector similarity filtering. [0029] Several example scenarios for a query of vectorized representations are described above, but they are only exemplary. The implementations of the present disclosure are not limited to these query scenarios. Other scenarios of query are also possible, for example, JOIN queries. In addition, combinations of any two or more scenarios of query are also possible. [0030] These examples may be applied to various online applications, thereby improving the service quality of online applications. In some scenarios, online applications that apply queries for vectorized representations usually have a strict latency requirement. For example, users using online applications usually expect feedback in a very short time. Latency of such applications is usually required to be within a few milliseconds. In this way, online applications may provide real-time query results to users, thereby improving user experience. [0031] Several examples in which the electronic device 110 determines the query result 132 for the query request 102 are described above. In the environment 100, the electronic device 110 may be any type of device with computing power, including a terminal device or a server device. The terminal device may be any type of mobile terminals, fixed terminals, or portable terminals, including mobile phones, desktop computers, laptop computers, notebook computers, netbook computers, tablet computers, media computers, multimedia tablets, personal communication system (PCS) devices, personal navigation devices, personal digital assistant (PDA), audio/video players, digital cameras/video cameras, positioning devices, television receivers, radio broadcast receivers, e-book devices, gaming devices, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. The server devices may 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. [0032] It should be understood that the structure and functions of the environment 100 are described for illustrative purposes only, without implying any limitation on the scope of the present disclosure. [0033] As mentioned briefly above, traditional semantic analysis-based query schemes are difficult to achieve queries for vectorized representations of such complex data. In particular, for online query services, it is usually necessary to determine query results in a very short time. This proposes a strict latency requirement for queries for vectorized representations. [0034] In a conventional solution, search methods such as K-Nearest Neighbor (KNN) are used to search for one or more matching results with the highest similarity from the entire data (that is, all data samples in a database). Although such a solution may obtain an accurate query result, it usually takes a long time. Considering that online search services usually require a quick determination of the query result, such a solution is usually difficult to meet the strict time requirement of online search services. [0035] Given the above, for such a query for more complex vectorized representations, a local search may be used instead of a global search to find an approximate matching result as the final query result. Therefore, a solution for approximate vector search is produced. In this solution, similar to relational databases, vector indices are used to support the approximate vector search, for example, graph-based vector indices or clustering-based vector indices. [0036] Taking clustering-based vector indices as an example, during a traversal process, vectors in the database are clustered to obtain clusters. Centroids of respective clusters are compared with the query vector, thereby determining one or more clusters that are relatively adjacent. One or more clusters are searched to obtain K vectors that are relatively matched. [0037] Taking graph-based vector indices as an example, respective vectors in the database are used as nodes of the graph, and a degree of difference between different vectors is determined as a distance between respective nodes. In this way, nodes of respective vectors in respective databases are connected into a relational graph. During the traversal process, an entry node for the query may be selected randomly. A distance between a 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 K approximate vectors are determined. [0038] However, one difficulty in these solutions of vector indices is how to determine the value of K. The value of K may vary greatly for different application scenarios and different queries, making it difficult to predict. For example, in a query with a filter condition, if the value of K is set to be relatively small, remaining vectors after filtering through the filter condition may not be enough for the requested amount, therefore at least one more round of traversal is required. If the value of K is set to be relatively large, many unnecessary traversal steps may exist. Either way reduces the performance of the query. [0039] To this end, the implementations of the present disclosure provide a query scheme for vectorized representations. According to the implementations of the present disclosure, the vectorized representation set is traversed for the query request indicating the target vectorized representation. During the query process, candidate vectorized representations are determined from the vectorized representation set as at least a portion of the candidate set in a previous query step of the query process. In the current query step, a first reference distance is determined based on respective distances between candidate vectorized representations and the target vectorized representation. For example, the maximum distance among these distances may be determined as the first reference distance. A second reference distance is determined at least based on a second distance between the current queried vectorized representation and the target vectorized representation. It is determined that whether the query process is terminated at least according to the comparison of these two reference distances. If the query process is terminated, the query result for the target vectorized representation is determined based on the candidate set. [0040] In the implementations of the present disclosure, comparisons of the two reference distances may indicate a current trend of the query process, that is, indicate 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 may be terminated. According to the implementations of the present disclosure, additional index query termination condition check is introduced without modifying the underlying index traversal logic. The search may be completed and the query result may be obtained as early as possible while ensuring the accuracy. In this way, the query efficiency for vectorized representations is improved advantageously. [0041] The example embodiments of the present disclosure are described below with reference to the accompanying drawings. Relaxed monotonicity for vector indices [0042] As aforementioned, some schemes of vector indices have been proposed to solve the vector query problem. Through the analysis of various schemes of vector indices, the relaxed monotonicity of vector indices is proposed in the implementations of the present disclosure. The relaxed monotonicity of vector indices will be described in detail below. [0043] The inventors realized that unlike traditional scalar indices, indices of queries for high-dimensional vectors are usually designed for approximate TopK queries and cannot follow the monotonicity of indices. Figs. 2A and 2B show traversal results 200 and 250 for the vectorized representation set, respectively. In the example of Fig. 2A, clustering-based vector indices are used for traversal. In the example of Fig. 2B, graph-based vector indices are used for traversal. For vector sets with these two types of vector indices, multiple traversal experiments are performed using the TopK query as an example. Figs. 2A and 2B show the traversal results 200 and 250, respectively. The traversal results 200 and 250 show distances between the traversed vectors and the query vector at different steps of traversal, respectively. [0044] By analyzing the traversal results 200 and 250, it may be noted that this manner of traversing by vector indices does not follow monotonicity. As the traversal process progresses, the distances between the traversed vectors and the query vector fluctuate unpredictably. Due to the lack of monotonicity, a query result that meets the query request cannot be found solely according to index traversal. [0045] Although the above traversal results 200 and 250 indicate a lack of monotonicity, both of these traversal results 200 and 250 show similar two-phase traversal patterns. As shown in Fig. 2A, in the left part of a dashed line 210 (also referred to as a first phase of the traversal), although there is a fluctuation in distances between the traversed vectors and the query vector, the index traversal approaches a target area where the query result is located continuously. While in the right part of the dashed line 210 (also referred to as a second phase of the traversal), the index traversal stabilizes gradually and deviates from the target area gradually. Similar to Fig. 2A, Fig.2B shows a similar two-phase traversal pattern indicated by a dashed line 260. [0046] For the purpose of explanation, only the example traversal results of Figs. 2A and 2B are shown herein. In fact, the inventor used different types of vector indices to analyze queries of vectorized representations for various databases, all of which showed similar traversal patterns. In such a two-phase traversal pattern, the query result usually may not be found in the second phase of the traversal. If a step of traversing to the second phase may be found, the traversal may be ended early, thereby speeding up the determination process of the query result. [0047] Based on this two-phase traversal pattern, relaxed monotonicity is proposed in the implementations of the present disclosure. As shown in Figs. 2A and 2B, as the traversal of the first phase progresses, the distances between the traversed vectors and the query vector gradually decreases in fluctuation and become stable in the traversal of the second phase. Such gradual decrease having fluctuation in the first phase of the traversal is referred to as having “relaxed monotonicity”. [0048] An example search process for the target vectorized representation is described in combination with Fig. 3 as below. In the example of Fig. 3, the order in which respective vectorized representations are traversed by index is shown by a trajectory 320 which is shown by the dashed arrow in the figure, that is, the traversal is in the order of a vectorized representation 322, a vectorized representation 324, a vectorized representation 326, .... [0049] In some implementations, to determine whether to enter the second phase of the traversal, it is necessary to determine the range of an adjacent area for the target vectorized representation for the query request. In the example of Fig. 3, a range of spherical area is described as an example, where a spherical area 310 represents an adjacent area of a target vectorized representation 301, which is also referred to as the target area. The query result for the target vectorized representation 301 may be located within the area 310. The area 310 has a radius 311 which is also referred to as the first reference distance. It should be understood that in some implementations, the target area may also have a shape other than sphere. [0050] In the current traversal step s, the first reference distance, that is, the radius 311, may be determined according to results of a previous traversal. As an example, the radius 311 may be obtained by Equation (1): (1)
Figure imgf000012_0001
where q represents target represents ^^^ represents the vectorized representation traversed in the ^^௧^ step, j is less than the current steps to be traversed s, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^൫ ^^, ^^^൯ represents a distance between the vectorized representation traversed in the ^^ ௧^ step and the target vectorized representation 301, TopE represents E vectorized representations closest to q (or referred to as most similar to q) in the vectorized representations traversed before the current traversal step s, and Max represents the maximum value. In other words, in this example, the maximum distance among the E vectorized representations (also referred to as candidate vectorized representations) traversed before the current traversal step s is determined as the first reference distance, that is, the radius 311. [0051] It should be understood that in some implementations, other methods may be used to determine the radius 311. For example, the radius 311 may be determined by averaging, weighted averaging, or other appropriate operations on the respective distances of the E candidate vectorized representations. 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 regard. [0052] Using the first reference distance, it may be indicated that the target vectorized representation may be located in the target area or range in the vector space. To check monotonicity, the current index traversal position needs to be considered, which may represent the distance between the current traversed vectorized representation and the target vectorized representation or may represent the distance between a most recent traversed vectorized representation and the target vectorized representation. To this end, the second reference distance may be determined based at least on the distance between the current traversed vectorized representation and the target vectorized representation. The second reference distance corresponds to all current traversal positions. [0053] 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. Correspondingly, the distance between the current traversed vectorized representation and the target vectorized representation may be determined as the second reference distance. [0054] In some implementations, the current index traversal position may represent respective distances between a plurality of vectorized representations within the current traversal window (including the most recent traversal steps, also referred to as a traversal step window or a scan window) and the target vectorized representation. Accordingly, the second reference distance may be determined based on respective distances (also referred to as the second distance) between a plurality of vectorized representations within a traversal window 340 and the target vectorized representation. 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, the traversal window may include a single vectorized representation, that is, the length of the traversal window may be 1. [0055] In some implementations, the second reference distance may be determined by averaging, weighted averaging, or other appropriate operations on respective 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. [0056] In some implementations, in a case that a plurality of vectorized representations is included in the traversal window 340, a median distance of the respective distances between these vectorized representations and the target vectorized representation may be determined as the second reference distance. In such implementations, the second reference distance may be expressed as Equation (2): (2)
Figure imgf000013_0001
, ^^^ the vectorized representation in the traversal window 340, ^^ ^^ ^^ ^^ ^^ ^^ ^^ ^^^ ^^, ^^^^ represents a distance between the vectorized representation ^^^ and the target vectorized representation 301, and Median represents the median distance.
Figure imgf000013_0002
[0057] By using the median distance as the second
Figure imgf000013_0003
distance, outlier vectorized representations in the traversal window, for example, vectorized representations 342 and 346, may be discarded. The distances between these outlier vectorized representations and the target vectorized representation are too large or too small compared to other vectorized representations in the traversal window 340, which may easily cause a deviation in the determined result of the second reference distance. The judgment result of relaxed monotonicity may be more accurate by using the median distance as the second reference distance. [0058] Considering Equation (1) and Equation (2), relaxed monotonicity may be defined by Equation (3): (3)
Figure imgf000014_0001
where specifically, if a s, indices follow relaxed monotonicity, that is, all traversal steps t after the traversal step s exceed the target area of the target vectorized representation q defined by ^^ ^. [0059] In some implementations, relaxed monotonicity may be checked by comparing the aforementioned first reference distance (in this example, the radius 311) with the second reference distance (for example, a median distance 331). As an example, a relaxed monotonicity check (also referred to as a relaxed monotonicity judgment) may be performed by Equation (4): (4) where specifically, if the second
Figure imgf000014_0002
^^^, the relaxed monotonicity condition is satisfied. This indicates that the traversal of the second phase starts from here. [0060] Several examples of performing the relaxed monotonicity check have been described above using Equation (3) and Equation (4) as examples. It should be understood that in some implementations, methods other than Equation (3) and Equation (4) may be used to perform the relaxed monotonicity check, and the implementations disclosed herein are not limited in this regard. [0061] By performing the relaxed monotonicity check, whether the traversal process has entered the second phase may be determined. This allows the traversal process to be terminated early, thereby completing the traversal and obtaining the query result as early as possible while ensuring accuracy. [0062] Next, an example architecture 400 for traversing and querying vectorized representations based on the relaxed monotonicity check will be described in combination with Fig. 4. Example Architecture [0063] Fig. 4 shows the example architecture 400 for querying vectorized representations according to some implementations of the present disclosure. 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. [0064] The indexing system 410 may be configured to maintain indices of respective vectorized representations 122, such as in the vectorized representation set 120 of Fig. 1. The indexing system 410 may further be configured to traverse respective vectorized representations 122 based on a traversal algorithm 411. The indexing system 410 may transmit a current traversed vectorized representation 412 (referred to as a current vectorized representation 412 in short) or its information to the index scanning module 420. [0065] In the current traversal step, the index scanning module 420 may perform a relaxed monotonicity check 422 based on vectorized representations within a traversal step window (also referred to as a traversal window or a scanning window) of the current vectorized representation 412. For example, the traversal step window may be a window with a 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 scanning module 420 may perform the relaxed monotonicity check 422 using Equation (3). Specifically, the first reference distance may be determined based on respective distances between candidate vectorized representations determined in a previous traversal step and the target vectorized representation. For example, the first reference distance may be determined as ^^^ according to Equation (1). The second reference distance may be determined based on respective distances between vectorized representations traversed in the most recent traversal steps in the traversal step window and the target vectorized representation. For example, the second reference distance may be determined as ^^^ ^ according to Equation (2). [0066] By way of example and without any limitation, in order to perform the relaxed monotonicity check 422, two queues may be used in the architecture 400 to track the current traversal state. Specifically, a queue of size E (also referred to as a priority queue or a minimum queue) may be used to maintain E candidate vectorized representations closest to the target vectorized representation visited during the traversal process. Another queue of size w (also referred to as a most recent queue) may be used to maintain w vectorized representations visited recently. These two queues may be updated as the traversal process progresses. [0067] 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 on a candidate set 442. For example, if the number of candidate vectorized representations in the candidate set 442 does not reach a predetermined number (for example, 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 the predetermined number, whether to update the candidate set 442 may be determined based on the respective distances between respective candidate vectorized representations and the current vectorized representations 412 and the target vectorized representation. Specifically, if the distance between the current vectorized representation 412 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 412 may be added to the candidate set 442, and the candidate vectorized representation with the largest distance from the target vectorized representation in the original candidate vectorized representations may be removed from the candidate set 442. In other words, the sorting module 440 may only retain a predetermined number of candidate vectorized representations with the minimum distance after sorting as the candidate set 442. [0068] In addition, the result of the relaxed monotonicity check 422 may be provided to the sorting module 440 for a termination check 444, thereby determining whether to terminate the traversal process. In addition to the result of the relaxed monotonicity check 422, the execution of the termination check 444 may also consider other additional conditions, for example, the original termination condition of the traversal algorithm 411 (if any). In a case where the relaxed monotonicity check 422 is passed (referring to that Equation (3) is satisfied) 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 top K (TopK) vectorized representations, for example, K vectorized representations with the minimum distance, from the candidate set 442, and output them as the query result 132. [0069] In the illustrated example, the relaxed monotonicity check 422 is implemented in the index scanning module 420. In the architecture 400 shown in Fig. 4, in each traversal step, vectorized representations of the current traversal are returned and the relaxed monotonicity check is performed. Compared with the traditional indexing traversal process, where the index system may only return K results at once, performing the relaxed monotonicity check in each traversal step may control the timely termination of the traversal process, which is conducive to terminating the traversal process as early as possible, thereby improving query efficiency. [0070] Next, several examples of searches based on the architecture 400 will be described for different types of indices. [0071] In one example, the traversal algorithm 411 of the indexing system 410 may employ a graph-based vector index to determine vectorized representations to be traversed during the traversal. The graph-based vector index includes a hierarchical neighborhood graph where the upper-layer graph keeps coarse-grained samples of the lower-layer graph. The approximate nearest point found in the upper-layer graph may serve as the traversal entry point of the lower-layer graph. In such an example, the candidate set 442 may use the form of a priority queue. [0072] For such a graph-based vector index, the traversal algorithm 411 may use, such as a best-first (BF) graph traversal from a fixed starting point. BF search maintains a sorted candidate set 442 (for example, a sorted priority queue) with the size of ef. The candidate set 442 may define the neighborhood spherical area 310, such as that shown in Fig. 3, in which there are ef vectorized representations. For the graph-based vector index, the number E of vectorized representations in the candidate set 442 may be equal to ef. [0073] BF traversal explores the index graph through vectorized representations in the candidate set 442 and expands the exploration range by visiting its neighbor nodes. If a neighbor node has not been visited and its distance to the target vectorized representation q is smaller than the farthest vectorized representation in the candidate set 442 sorted by the sorting module 440 (in some examples, its distance to q is the neighborhood radius, that is, 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 resorted by the sorting module 440. In this example, the size w of the traversal window may be equal to 1. [0074] In the example of traversing graph-based vector indices, only relevant states required for the index traversal algorithm may be retained. Relevant states may include a bitmap to record vectorized representations traversed or visited previously, the current vectorized representation being visited, and vectorized representations to be visited next. These relevant states will be kept during the query life cycle. To initiate a query on an index of a vectorized representation, the electronic device 110 may call Open function or interface to search on high-layer graphs. During query execution, each call to Next function will return the current closest unvisited node. The current best unvisited node is recorded and its neighbors are expanded into untraversed vectorized representations in the relevant state. The relevant state will be cleared in Close function. [0075] In another example, the traversal algorithm 411 in the indexing system 410 may employ a clustering-based or partition-based vector index to determine vectorized representations to be traversed. In the clustering-based vector index, respective vectorized representations in the vectorized representation set 120 may be divided into different clusters, where adjacent vectorized representations are clustered into one cluster. For such a clustering-based vector index, the traversal algorithm 411 may traverse vectorized representations in a fixed number of m clusters closest to the target vectorized representation (K, m are any natural number). During the traversal process, if the relaxed monotonicity check 422 of such as Equation (3) is passed after traversing vectorized representations in m clusters, the traversal process may be terminated. In this example, the number of vectorized representations E in the candidate set 442 may be set to the number of vectorized representations K of the query result of TopK query, and the size of the traversal window w may be set to the number of total vectorized representations. [0076] Exemplary, a clustering-based vector index may cluster vectorized representations into lists and select a centroid as a representative point of each list. In the Open interface used to initiate index traversal, the architecture 400 may sort all the lists from near to far based on the distance between the target vectorized representation and the centroids. Upon calls to Next, the vectorized representations in the corresponding nearest lists are read one by one. The query execution state in the clustering-based vector index includes sorted lists and the current read position, which will be destroyed by a Close interface. [0077] In a further example, the traversal algorithm 411 of the indexing system 410 may employ a conventional index with strict monotonicity, for example, a scalar index. Such an index may be regarded as a special example of relaxed monotonicity. In this example, the number of candidate vectorized representations E and the size of the traversal window w are both set to 1, and Equation (3) is always satisfied. [0078] It should be understood that the types of indices and the traversal algorithm 411 of the indices described above are only exemplary and not limited. The aforementioned number of candidate vectorized representations, the size of the traversal window and so on may be adjusted continuously during the traversal process. In some scenarios, the accuracy of the query result 132 may be improved using a larger number of candidate vectorized representations, size of the traversal window, but it takes relatively more time. The latency may be reduced using a smaller number of candidate vectorized representations, size of the traversal window, but the accuracy may be reduced. Therefore, an appropriate number of candidate vectorized representations, size of the traversal window may be selected by considering to trade off the accuracy requirement and the latency requirement. [0079] Several examples of queries for vectorized representations based on relaxed monotonicity are described above. However, it should be understood that the respective components of the architecture 400 are only exemplary and not intended to be limiting. Depending on the specific query scenario, the architecture 400 may include additional modules or the modules shown therein may be changed. As shown in Fig. 4, in some implementations, the query request may further indicate a filter condition. The filter 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 further indicate product price as a filter condition. In this implementation, the architecture 400 may further include a filtering module 430. [0080] The filtering module 430 may be configured to determine whether the current traversed vectorized representation (for example, the current vectorized representation 412) satisfies the filter condition indicated by the query request. If the current vectorized representation 412 satisfies the filter condition, the filtering module 430 may 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 filter condition, the current vectorized representation 412 may 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, the termination check 444 may be performed and the next traversal step may be started while the traversal process is not terminated. [0081] 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, depending on the query scenario, the sorting performed by the sorting module 440 may be replaced with other processing or may be omitted. However, it should be understood that the candidate set 442 and the termination check 444 may be retained. For example, the sorting may be omitted for the aforementioned similarity filtering scenario. [0082] Several examples of querying vectorized representations based on relaxed monotonicity are described above in combination with the example architecture 400. Each of the above examples may be implemented separately or combined with any appropriate way. By adopting these relaxed monotonicity-based query schemes, the traversal may be completed and the query result may be obtained as early as possible while ensuring the accuracy. In this way, the query efficiency for vectorized representations is improved advantageously. Example Multi-index Vectorized Representation Query [0083] As mentioned above, in some implementations, vectorized representations may have vector components corresponding to multiple indices. For example, the target vectorized representation includes a plurality of vector components corresponding to a plurality of attributes or modalities. The vectorized representations in the vectorized representation set may also include the plurality of vector components corresponding to these attributes or modalities. For such multi-index vectorized representations, respective vector components may have respective vector indices. That is, a plurality of vector indices corresponding to different attributes or modalities may point to the same vectorized representation. [0084] As mentioned briefly above, for the query of multi-index vectorized representations, a satisfying query result is hard to get through conventional query schemes which often take a longer time. Specifically, to support the multi-index vectorized representation query, TopK-based conventional query systems may only perform multi-column scan according to multiple columns of sorted vectorized representations collected by TopK, where each column corresponds to an index. If there is no candidate vectorized representation meets the requirements of respective indices after the multi-column scan, the value K used by TopK will be increased, for example, by double. Multi-column TopK queries may be re-executed for the increased value K until the multi-column scan results collected for a certain K may meet the requirements of respective indices at the same time. Such a query method of increasing the value K continuously may cause longer latency, which is difficult to meet the requirements, especially the latency requirement of online applications. [0085] In such conventional query schemes, vector indices of vector components of each index are traversed in no random access (NRA) manners such as round-robin and so on. Because vector indices of different indices of the same vectorized representation may return results with different similarity qualities, if candidate results obtained through a certain column TopK query have poor similarity results in a further index aspect, then returning the results for subsequent computations will cause unnecessary resource waste. [0086] In some implementations of the present disclosure, further optimization is carried out for multi-index vectorized representation queries to improve query efficiency for multi-index vectorized representations. According to such implementations, local queries and global queries are considered comprehensively for traversal decisions. For example, the traversal process may be divided into multiple traversal rounds. In one round, each index is used for the index traversal decision at least once. Each round maintains a local candidate set which is used to store the query results of the previous round, for example, each vectorized representation visited or traversed in the previous round. This local candidate set may be used to determine which vector index is more likely to return better results, so that it may be visited more in the next round. In addition, to avoid being trapped into local optima, the global candidate set may further be stored and updated after each traversal round, which is similar to the candidate set 442 described above. In this way, by considering the local candidate set and the global candidate set comprehensively, higher-quality vector indices may be traversed more times while lower-quality vector indices may still be traversed. [0087] Fig. 5 shows a schematic diagram of an example architecture 500 for querying vectorized representations of multi-index in accordance with some implementations of the present disclosure. The example architecture 500 may 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 may be regarded as an example of the termination check 444 in Fig. 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 traversed according to the traversal algorithm 411 adopted by the indexing system 410, such as in Fig. 4, respectively. [0088] In some implementations, the traversal decision module 510 may be configured to determine a target index from a plurality of indices 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 further be configured to select a traversed vectorized representation from the vectorized representation set 120 in the current traversal step according to the target index. [0089] In some implementations, the traversal decision module 510 may select the target index according to the importance of each index. For example, the probability of each index or indices being selected may be set according to the importance. In the current traversal step, selection is made according to the set probability, for example, by a manner of generating random numbers. As an example, for item querying tasks, the vectorized representation of each candidate item may have vector components such as an image, a description document, and the like. If a user would like to query the query result that better matches the visual feature of the item, selected probability of the visual index (corresponding to the image) may be set higher than that of the semantic index (corresponding to the description document). [0090] In some implementations, the traversal process may include a plurality of traversal rounds. In each traversal round, a vectorized representation to be traversed may be selected according to each index of the plurality of indices at least once. As an example, if there are two target indices and respective indices are used in a ratio of 2:1, a first target index is used to select the vectorized representation to be traversed twice in one round, and a second target index is used to select the vectorized representation to be traversed once. In this example of traversing by rounds, the traversal decision module 510 may select the target index according to traversal results of a previous traversal round. [0091] In some implementations, the traversal decision module 510 may store a local candidate set 514 that includes vectorized representations traversed in the previous round (for example, the most recent round or rounds). The traversal decision module 510 may further include a score generator 512 configured to determine, for a current round including the current traversal step, respective scores for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation traversed in a previous round stored in the local candidate set 514 (also referred to as the local candidate vectorized representations) and the target vectorized representation. As an example, for some index, a score for the index may be determined based on respective distances (for example, an average or an weighted average) between vector components of the index corresponding to the local candidate vectorized representation and a vector component of the index corresponding to the target vectorized representation. [0092] Based on respective scores of the plurality of indices, the traversal decision module 510 may determine respective times for the plurality of indices in the current round, and a time for each index indicates the number of traversal steps for which a vectorized representation to be traversed is selected in the current round. Based on the respective times for the plurality of indices, the traversal decision module 510 may select the target index from the plurality of indices. As an example, in one round, times corresponding to some index may be represented by Equation (5): (5) where ^^^ represents
Figure imgf000022_0001
^^ a predetermined hyper-parameter, ^^ ^^ ^^^ represents the score of index i, ^^ ^^ ^^^ represents a respective score of index j, j is a positive integer from 1 to m, and m is the number of the plurality of indices. That is, the proportion of times that these indices are used in a round may be determined by Equation (5). Although “score” is used in the above description, “score” is not essential, is used to characterize a distance between the traversed vectorized representation and the target vectorized representation. Therefore, in some implementations, respective times corresponding to these indices may be determined based on the distance. [0093] As described above, after determining the target index, the traversal decision module 510 may select a traversed vectorized representation from the vectorized representation set in the current traversal step according to the target index. Taking the selected target index corresponding to the vector index (2) 504 as an example, the traversal decision module 510 may select a vectorized representation to be traversed according to the vector index (2) 504. [0094] In a case where a traversed vectorized representation is determined by the traversal decision module 510, a distance between the traversed vectorized representation and the target vectorized representation may be determined by the score generator 512 or by other modules. Specifically, for each index in the plurality of indices, a distance component between a vector component of the traversed vectorized representation corresponding to the index and a vector component of the target vectorized representation corresponding to the index may be determined. Further, based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices, a distance between the traversed vectorized representation and the target vectorized representation is determined. [0095] In some implementations, the respective weights of the plurality of indices may be preset. For example, weights of respective indices may be preset according to the importance of the respective indices. In some implementations, respective weights of these indices may be set according to respective scores determined by the score generator 512. For example, an index with higher score will be given a higher weight. In other words, in such implementations, weights of the indices correspond to the times it is used in a round. [0096] In a case where the distance between the traversed vectorized representation and the target vectorized representation is determined, the traversal decision module 510 may output the traversed vectorized representation to a global candidate set 520. If the number of candidate vectorized representations in the global candidate set 520 does not exceed a 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 the predetermined candidate number of global candidate vectorized representations, the distance between the traversed vectorized representation and the target vectorized representation will be compared with respective distances between the global candidate vectorized representations in the global candidate set 520 and the target vectorized representation. If the distance of the traversed vectorized representation is smaller than some distance of the global candidate vectorized representations, the global candidate set 520 will be updated. That is, the current traversed vectorized representation will be added to the global candidate set 520, and the vectorized representation with the lowest order (for example, with the largest distance from the target vectorized representation) in the original global candidate set 520 will be removed. [0097] As shown in Fig. 5, the example architecture 500 further includes a relaxed monotonicity check 515 and the termination check 530, which are similar to the relaxed monotonicity check 422 and the termination check 444 shown in Fig. 4, respectively. For example, the relaxed monotonicity check 515 may determine whether relaxed monotonicity is passed based on Equation (3) in the current step. The termination check 530 may determine whether to terminate the traversal process according to whether relaxed monotonicity check is passed and whether the original termination condition (if any) of the traversal algorithm is satisfied. In a case where the relaxed monotonicity check 515 is passed (referring to the satisfaction of Equation (3)) and the original termination condition is satisfied, the traversal may be terminated. After the traversal is terminated, the query result 132 will be output. [0098] A query scheme for multi-index vectorized representations is described in combination with Fig. 5. By adopting this scheme, the query result may be obtained and the check may be terminated based on the local candidate set and the global candidate set of the current round. In such implementations, query results that are as accurate as possible may be facilitated to be found with high efficiency. In this way, the query efficiency for vectorized representations is improved advantageously. [0099] 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. Query performance analysis [00100] The query for vectorized representation based on relaxed monotonicity proposed in the present disclosure may be applied to various query scenarios. Next, taking a TopK query with a filter condition as an example, the query performance using conventional query schemes and that using the present scheme will be analyzed separately. [00101] Firstly, the performance of the conventional query scheme is described. In the conventional query scheme, to find K vectorized representations matching the filter condition, a conventional TopK-based querying system collects and sorts K’ vectorized representations through TopK(K’). K’ represents the minimum number of vectorized representations that need to be traversed to obtain TopK. To obtain K’ vectorized representations, vectorized representations need to be traversed according to the index with a range ^^^. The query then continues running on K’ vectorized representations by applying the filter condition and a TopK operator to obtain the final query results. The above process of the conventional query scheme may be represented by Equation (6): (6) where ^^^ Filter
Figure imgf000024_0001
represents the filter condition, and Sort represents the sorting. [00102] Using the filter selection rate (filter_selectivity) as the ratio of the output set on the input set of the filter operator, Equation (6) may be represented as Equation (7): , (7) ^^ ^,
Figure imgf000024_0002
, to Equation (8):
Figure imgf000024_0003
(8) [00104] Next, the query performance of the query scheme based on the present disclosure will be analyzed. According to the query scheme of the present disclosure, vectorized representations are traversed in the range R2 on the same index as the TopK-based system, as shown in Equation (9): (9)
Figure imgf000025_0001
where r2 represents the query [00105] In some implementations, the traversal range R 2 adopted in the query scheme of the present disclosure may be the same as R1 adopted in the conventional TopK-based scheme, that is, ^^^ ൌ ^^ଶ . Comparing Equation (8) with Equation (9), only the order of filter operator and sort operator is exchanged, therefore ^^^ ൌ ^^ଶ . [00106] However, in the above analysis, it is assumed that the conventional TopK-based system may prophesy the optimal ^^^, that is, , however, this is usually difficult to achieve. If , the conventional system cannot get enough results, leading to inaccurate query results. Conversely, if , although more accurate results may be obtained, additional
Figure imgf000025_0002
in longer latency. [00107] Some conventional TopK-based systems use a manner of continuous experimentation until to determine K’, however this manner may result in and processing. In contrast, in the query scheme of the present
Figure imgf000025_0003
traversed in each traversal step are returned. That is, according to the scheme of the present disclosure, is determined in real time during the traversal process, so there is no need for this continuous experimentation process to make a traversal termination decision. Therefore, the query scheme of the present disclosure may ensure high accuracy while meeting performance requirements such as latency. [00108] The performance of the query scheme of the present disclosure and the conventional query scheme is analyzed by taking the TopK query with the filter condition as an example. Next, a range filter query scenario will be analyzed as an example. [00109] The TopK-based range filter query may be represented as Equation (10): (10) where the meanings of are the same as above, so are not here. [00110] Similar to
Figure imgf000025_0004
into Equation (11) as follows:
Figure imgf000026_0001
[00111] Similarly, if it is assumed that the conventional TopK-based system may predict the optimal value ^ ^ ^, and it is assumed that the query produces T vectorized representations, that is, the value makes . Based on ^^^, Equation (11) may be simplified to Equation (12): . [00112]
Figure imgf000026_0002
representations will be traversed in the range R2 on the same index as the TopK-based system, and query results r2 will be obtained, as shown in Equation (13): . (13) [00113] In some
Figure imgf000026_0003
present disclosure may be the same as R1 used in the conventional TopK-based scheme, that is, R1= R2. Comparing Equation (12) with Equation (13), because the filter condition is not sensitive to the sorting order, r1= r2. Example cost estimation [00114] Complex queries often require effective cost estimation for various query plans. Generally speaking, cost estimation includes vector algebra computation (for example, distance calculation), selectivity estimation in case the query contains filters, and index scan cost, and so on. Conventional query schemes, for example, traditional databases, use a constant value t to estimate the cost of scalar data computation, for example, t= 0.0025 or any other appropriate value. Because vector computation involves the calculation of the distance between vectors, which is proportional to the number of dimensions, the cost of vector computation is higher. [00115] In some implementations, the cost of vector computation for vectorized representation query may be represented as Equation (14): (14) where represents scalar operation, t may be a
Figure imgf000026_0004
such as single instruction multiple data (SIMD) for vector computation, and dim represents the dimension of vectorized representation. [00116] In some implementations, if a query request contains a filter condition, the query may estimate selectivity. That is, the ratio of elements that may pass the filter condition may be estimated. As an example, sampling-based methods may be used to measure the distribution of high-dimensional vectorized representations. Specifically, the vectorized representation data may be uniformly sampled at a certain ratio, and the sampled vectorized representations are stored in the metadata of the database (for example, the vectorized representation set). Given a query request q, it applies the filter on the sampled data to estimate the selectivity Sel on the full vectorized representation dataset, as shown in Equation (15):
Figure imgf000027_0001
where represents on query request q, and
Figure imgf000027_0002
the selectivity on the full data. In some implementations, selectivity
Figure imgf000027_0003
by adjusting the sampling rate to obtain shorter latency. [00117] In some implementations, index scan cost may be estimated. The index scan cost includes start-up cost and traversal cost. Start-up cost is the cost to locate the region nearby the target vectorized representation before returning vectorized representation data. Traversal cost represents the cost to traverse the matched elements through the index. For each index traversal step, the cost Cstep includes tIO and tv(dim), that is, Cstep= tv(dim)+tIO, where tIO represents the input/output (IO) cost to fetch the index data from a storage device (such as a hard disk), and tv(dim) represents the cost to calculate the distance. [00118] For clustering-based indices, the index scan cost CP may be represented by Equation (16): (16) where
Figure imgf000027_0004
the average per m represents of clusters that the index traversal algorithm requires to traverse for relaxed monotonicity check. [00119] For graph-based indices, the index scan cost may be represented by Equation (17): (17) where NE
Figure imgf000027_0005
the average times of distance function called per step to reach next point. Nstart, NE, and Riter are dependent on the hyper-parameters related to the data distribution and the index. The data distribution and hyper-parameters may be automatically estimated during the sampling process. [00120] By using the computation methods listed above, respective costs in the vectorized representation query process may be determined. Therefore, query planning may be carried out. Sample workflow [00121] Fig. 6 shows a flowchart of a process 600 for querying vectorized representations according to some implementations of the present disclosure. The process 600 may be implemented at the electronic device 110 of Fig. 1. [00122] At block 610, the electronic device 110 receives a query request for a vectorized representation set. The query request indicates a target vectorized representation. [00123] At block 620, the electronic device 110 may perform processes from block 622 to block 624 in a current query step of a query process for the vectorized representation set. Specifically, at block 622, the electronic device 110 determines a first reference distance based on respective first distances between candidate vectorized representations and the target vectorized representation. The candidate vectorized representations are determined from the vectorized representation set in a previous query step of the query process. In some implementations, the electronic device 110 may determine the largest distance of the respective first distances as the first reference distance. [00124] At block 624, the electronic device 110 determines a second reference distance based at least on a distance between a queried vectorized representation in the current query step and the target vectorized representation. In some implementations, the electronic device 110 may determine respective second distances between vectorized representations queried in a 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 respective second distances. In some implementations, the electronic device 110 may determine a median distance of the respective second distances as the second reference distance. [00125] At block 626, the electronic device 110 determines that the query process is terminated based at least on the second reference distance being larger than the first reference distance. If the electronic device 110 determines the termination of the query process at block 626, the process 600 is performed to block 630. At block 630, the electronic device 110 determines a query result for the target vectorized representation based on the candidate vectorized representations. [00126] In some implementations, the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively. In such implementations, block 620 may further comprise an additional block. For example, the electronic device 110 may determine, in the current query step, a target index from the plurality of indices; and may select, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set. [00127] In some implementations, the query process comprises a plurality of query rounds. A vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once. In such implementations, the process 600 further comprises for a current round including the current query step, determining respective times for the plurality of indices, wherein a time for each index indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index, that is, a vectorized representation to be queried is selected according to the index in the plurality of query steps in the current round. In such implementations, determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices. [00128] In some implementations, the process 600 further comprises: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices. [00129] In some implementations, the query request further indicates a filter condition, and the process 600 further comprises: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations. Example Device [00130] Fig. 7 illustrates a block diagram of an electronic device in which various implementations of the subject matter described herein can be implemented. It should be appreciated that the electronic device 700 shown in Fig. 1 is merely provided as an example, without suggesting any limitation to the functionalities and scope of implementations of the subject matter described herein. [00131] As shown in Fig.7, the electronic device 700 includes a electronic device 700 in form of a general-purpose computing device. 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. [00132] In some implementations, the electronic device 700 may be implemented as a computing device, a computing system, a server, a mainframe, and other devices with computing capabilities. [00133] The processing unit 710 may be a physical or virtual processor and can implement various processes based on programs stored in the memory 720. In a multi-processor system, a plurality of processing units executes computer-executable instructions in parallel so as to improve the parallel processing capability of the electronic device 700. The processing unit 710 may comprise a central processing unit (CPU), a graphical processing unit (GPU), a microprocessor, a controller and/or a microcontroller or the like. The processing device 710 may be the same or different from the processing unit 710. [00134] The electronic device 700 usually includes various computer storage medium. Such computer storage medium may be any available medium accessible by the electronic device 700, including but not limited to, a volatile and non-volatile medium, or a detachable and non-detachable medium. The memory 720 may comprise a volatile memory (for example, a register, a cache, a random access memory (RAM)), a non-volatile memory (for example, a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory), or any combination thereof. The storage device 730 may comprise a detachable or non-detachable medium and may include a computer-readable medium such as a memory, a flash drive, a magnetic disk or any other medium, which can be used for storing information and/or data and be accessed in the electronic device 700. [00135] The electronic device 700 may further include additional detachable/non-detachable, volatile/non-volatile memory medium. Although not shown in Fig. 7, it is possible to provide a disk drive for reading from or writing into a detachable and non-volatile disk and an optical disc drive for reading from and writing into a detachable non-volatile optical disc. In such cases, each drive may be connected to a bus (not shown) via one or more data medium interfaces. [00136] The communication unit 740 communicates with a further electronic device via a communication medium. In addition, the functions of components in the electronic device 700 may be implemented by a single computing cluster or a plurality of computing machines that can communicate via communication connections. Therefore, the electronic device 700 can operate in a networked environment using a logical connection with one or more other servers, personal computers (PCs) or other general network nodes. [00137] The input device 750 may include one or more of various input devices, such as a mouse, a keyboard, a data input device, and the like. The output device 760 may include one or more of various output devices, such as a display, a data output device, and the like. By means of the communication unit 740, the electronic device 700 may further communicate with one or more external devices (not shown) such as the storage devices and display devices, with one or more devices enabling a user to interact with the electronic device 700, or with any devices (such as a network card, a modem, and the like) enabling the electronic device 700 to communicate with one or more other electronic devices, if required. Such communication may be performed via input/output (I/O) interfaces (not shown). [00138] In some implementations, as an alternative of being integrated on a single device, some or all components of the electronic device 700 may also be arranged in the form of a cloud computing architecture. In the cloud computing architecture, the components may be provided remotely and work together to implement the functions described in the subject matter described herein. In some implementations, cloud computing provides computing, software, data access and storage services, which will not require end users to be aware of the physical locations or configurations of the systems or hardware providing these services. In various implementations, the cloud computing provides the services via a wide area network (such as Internet) using proper protocols. For example, a cloud computing provider provides applications over the wide region network, which can be accessed through a web browser or any other computing components. The software or components of the cloud computing architecture and respective data may be stored on a server at a remote location. The computing resources in the cloud computing environment may be merged at locations of remote data centers or may be distributed. Cloud computing infrastructures may provide the services through a shared data center, though they behave as a single access point for users. Therefore, the cloud computing architecture may be used to provide the components and functions described herein from a service provider at a remote location. Alternatively, they may be provided from a conventional server or installed directly or otherwise on a client device. [00139] The electronic device 700 may be used to implement multiple implementations of the present disclosure. The memory 720 may include one or more modules having one or more program instructions. These modules can be accessed and executed by the processing unit 710 to perform functions of various implementations described herein. For example, the memory 720 may include a vectorized representation querying module 725 for querying the target vectorized representation indicated by the query request. As shown in Fig. 7, the electronic device 700 may obtain input required by the query through the input device 750, and may provide query output through the output device 760. In some implementations, the electronic device 700 may further receive input from other devices (not shown) via the communication unit 740. Example Implementations [00140] Some example implementations of the present disclosure are listed below. [00141] In one aspect, a computer implementation method is provided by the present disclosure. The method comprises: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations. [00142] In some implementations, determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances. [00143] In some implementations, determining the second reference distance based on the respective second distances comprises: determining a median distance of the respective second distances as the second reference distance. [00144] In some implementations, determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance. [00145] In some implementations, the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively. In such implementations, the method further comprises determining, in the current query step, a target index from the plurality of indices; and selecting, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set. [00146] In some implementations, the query process comprises a plurality of query rounds, a vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once. In such implementations, the method further comprises: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index. In such example implementations, determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices. [00147] In some implementations, the method further comprises: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices. [00148] In some implementations, the query request further indicates a filter condition, and the method further comprises: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations. [00149] In a further aspect, an electronic device is provided by the present disclosure. The electronic device comprises: a processing unit; and a memory coupled to the processing unit and comprising instructions stored thereon, the instructions, when executed by the processing unit, causing the device to perform acts comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations. [00150] In some implementations, determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances. [00151] In some implementations, determining the second reference distance based on the respective second distances comprises: determining a median distance of the respective second distances as the second reference distance. [00152] In some implementations, determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance. [00153] In some implementations, the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively, and the acts further comprise: determining, in the current query step, a target index from the plurality of indices; and selecting, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set. [00154] In some implementations, the query process comprises a plurality of query rounds, a vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once, and the acts further comprise: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index, and wherein determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices. [00155] In some implementations, the acts further comprise: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices. [00156] In some implementations, the query request further indicates a filter condition, and the acts further comprise: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations. [00157] In a further aspect, a computer program product is provided. The computer program product tangibly stored in a computer storage medium and comprising computer executable instructions that, when executed by a device, cause the device to perform acts comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations. [00158] In some implementations, determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances. [00159] In some implementations, determining the second reference distance based on the respective second distances comprises: determining a median distance of the respective second distances as the second reference distance. [00160] In some implementations, determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance. [00161] In some implementations, the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively, and the acts further comprise: determining, in the current query step, a target index from the plurality of indices; and selecting, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set. [00162] In some implementations, the query process comprises a plurality of query rounds, a vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once, and the acts further comprise: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index, and wherein determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices. [00163] In some implementations, the acts further comprise: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices. [00164] In some implementations, the query request further indicates a filter condition, and the acts further comprise: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations. [00165] In a further aspect, a computer-readable medium is provided by the present disclosure. The computer-readable medium has machine-executable instructions stored thereon which, when executed by a device, cause the device to perform one or more example implementations of the methods of the aforementioned aspects. [00166] The functionality described herein can be performed, at least in part, by one or more hardware logic components. For example, and without limitation, example types of hardware logic components that can be used include Field-Programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Application-specific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), and the like. [00167] Program code for carrying out methods of the subject matter described herein 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 apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowcharts and/or block diagrams to be implemented. The program code may execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or a server. [00168] In the context of this subject matter described herein, a machine-readable medium may be any tangible medium that may contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The 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, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. [00169] Further, although operations are depicted in a particular order, it should be understood that the operations are required to be executed in the particular order shown or in a sequential order, or all operations shown are required to be executed to achieve the expected results. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are contained in the above discussions, these should not be construed as limitations on the scope of the subject matter described herein. Certain features that are described in the context of separate implementations may also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation may also be implemented in multiple implementations separately or in any suitable sub-combination. [00170] Although the subject matter described herein has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter described herein specified in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

CLAIMS 1. A computer implemented method comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations.
2. The method of claim 1, wherein determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances.
3. The method of claim 2, wherein determining the second reference distance based on the respective second distances comprises: determining a median distance of the respective second distances as the second reference distance.
4. The method of claim 1, wherein determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance.
5. The method of claim 1, wherein the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively, and the method further comprises: determining, in the current query step, a target index from the plurality of indices; and selecting, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set.
6. The method of claim 5, wherein the query process comprises a plurality of query rounds, a vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once, and the method further comprises: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index, and wherein determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices.
7. The method of claim 5, further comprising: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices.
8. The method of claim 1, wherein the query request further indicates a filter condition, and the method further comprises: determining, in the current query step, whether the queried vectorized representation satisfies the filter condition; and in response to that the filter condition is satisfied, determining whether to perform an update to a candidate set, the candidate set comprising the candidate vectorized representations.
9. An electronic device, comprising: a processing unit; and a memory coupled to the processing unit and comprising instructions stored thereon, the instructions, when executed by the processing unit, causing the device to perform acts comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations.
10. The electronic device of claim 9, wherein determining the second reference distance comprises: determining respective second distances between vectorized representations queried in a query step window including the current query step and the target vectorized representation; and determining the second reference distance based on the respective second distances.
11. The electronic device of claim 9, wherein determining the first reference distance comprises: determining the largest distance of the respective first distances as the first reference distance.
12. The electronic device of claim 9, wherein the target vectorized representation comprises a plurality of vector components corresponding to a plurality of indices respectively, and a vectorized representation of the vectorized representation set comprises a plurality of vector components corresponding to the plurality of indices respectively, and the acts further comprise: determining, in the current query step, a target index from the plurality of indices; and selecting, according to the target index, the queried vectorized representation in the current query step from the vectorized representation set.
13. The electronic device of claim 12, wherein the query process comprises a plurality of query rounds, a vectorized representation to be queried is selected according to each index of the plurality of indices in each query round of the plurality of query rounds at least once, and the acts further comprise: determining, for a current round including the current query step, respective times for the plurality of indices based on respective distances in the plurality of indices between a vectorized representation queried in a previous round and the target vectorized representation, wherein a time for each index of the plurality of indices indicates the number of query steps for which a vectorized representation to be queried is selected in the current round according to the index, and wherein determining a target index from the plurality of indices comprises: selecting the target index from the plurality of indices based on the respective times for the plurality of indices.
14. The electronic device of claim 12, wherein the acts further comprise: determining, for each index of the plurality of indices, 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; and determining a distance between the queried vectorized representation and the target vectorized representation based on the distance components determined for the plurality of indices respectively and respective weights for the plurality of indices.
15. A computer program product tangibly stored in a computer storage medium and comprising computer executable instructions that, when executed by a device, cause the device to perform acts comprising: 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 respective first distances between candidate vectorized representations and the target vectorized representation, the candidate vectorized representations 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 a queried vectorized representation in the current query step and the target vectorized representation; determining that the query process is terminated based at least on the second reference distance being larger than the first reference distance; and in response to the termination of the query process, determining a query result for the target vectorized representation based on the candidate vectorized representations.
PCT/US2024/036472 2023-07-10 2024-07-02 Query for vectorized representations Ceased WO2025014686A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310840736.9 2023-07-10
CN202310840736.9A CN119293087A (en) 2023-07-10 2023-07-10 Querying vectorized representations

Publications (1)

Publication Number Publication Date
WO2025014686A1 true WO2025014686A1 (en) 2025-01-16

Family

ID=91959479

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2024/036472 Ceased WO2025014686A1 (en) 2023-07-10 2024-07-02 Query for vectorized representations

Country Status (2)

Country Link
CN (1) CN119293087A (en)
WO (1) WO2025014686A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120973826A (en) * 2024-05-16 2025-11-18 华为云计算技术有限公司 Methods, apparatus, devices, and storage media for querying vector data

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHEN PATRICK ET AL: "FINGER: Fast Inference for Graph-based Approximate Nearest Neighbor Search", PROCEEDINGS OF THE 21ST ANNUAL INTERNATIONAL CONFERENCE ON MOBILE SYSTEMS, APPLICATIONS AND SERVICES, ACMPUB27, NEW YORK, NY, USA, 30 April 2023 (2023-04-30), pages 3225 - 3235, XP059470761, ISBN: 979-8-4007-0110-8, DOI: 10.1145/3543507.3583318 *
MENGZHAO WANG ET AL: "Navigable Proximity Graph-Driven Native Hybrid Queries with Structured and Unstructured Constraints", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 25 March 2022 (2022-03-25), XP091184544 *

Also Published As

Publication number Publication date
CN119293087A (en) 2025-01-10

Similar Documents

Publication Publication Date Title
Li et al. Improving approximate nearest neighbor search through learned adaptive early termination
US20220083874A1 (en) Method and device for training search model, method for searching for target object, and storage medium
US10503765B2 (en) Visual interactive search
Pan et al. Fast GPU-based locality sensitive hashing for k-nearest neighbor computation
CN112860685B (en) Automatic recommendations for analysis of datasets
CN109241243B (en) Candidate document sorting method and device
CN113656440B (en) A database statement optimization method, device and equipment
CN113918807B (en) Data recommendation method, device, computing device and computer-readable storage medium
CN119089005A (en) A large-scale high-dimensional vector nearest neighbor data retrieval method and device
CN116028699A (en) Data query method, device and electronic equipment
Karri et al. AI-Driven Indexing Strategies
Mageirakos et al. Cracking vector search indexes
CN118964422A (en) Vector retrieval method, device, equipment and storage medium
WO2025014686A1 (en) Query for vectorized representations
JP5137339B2 (en) Server, system and method for retrieving clustered vector data
Lan et al. Cardinality Estimation for Similarity Search on High-Dimensional Data Objects: The Impact of Reference Objects.
CN119474463B (en) Vector retrieval method and device
Schuh et al. A comprehensive study of iDistance partitioning strategies for k NN queries and high-dimensional data indexing
CN120030048A (en) Automated interactive large-scale language model pipeline orchestration method, system, device and storage medium for complex queries
CN120045697A (en) Multi-agent recommendation method and device combined with preference learning, electronic equipment, storage medium and program product
Zhang et al. A learning-based framework for improving querying on web interfaces of curated knowledge bases
Antaris et al. Similarity search over the cloud based on image descriptors' dimensions value cardinalities
CN114625952B (en) Information recommendation method and system based on VSM and AMMK-means
CN111274265B (en) Methods and devices for integrated retrieval based on multiple retrieval methods
Feng et al. Effective optimizations of cluster-based nearest neighbor search in high-dimensional space

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24745585

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE