WO2016114797A1 - Shared intermediate hash values - Google Patents

Shared intermediate hash values Download PDF

Info

Publication number
WO2016114797A1
WO2016114797A1 PCT/US2015/011852 US2015011852W WO2016114797A1 WO 2016114797 A1 WO2016114797 A1 WO 2016114797A1 US 2015011852 W US2015011852 W US 2015011852W WO 2016114797 A1 WO2016114797 A1 WO 2016114797A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
hash table
candidate results
data
value
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/US2015/011852
Other languages
French (fr)
Inventor
Krishnamurthy Viswanathan
Maria T. GONZALEZ DIAZ
Jun Li
Mijung Kim
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.)
Hewlett Packard Enterprise Development LP
Original Assignee
Hewlett Packard Enterprise Development LP
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 Hewlett Packard Enterprise Development LP filed Critical Hewlett Packard Enterprise Development LP
Priority to PCT/US2015/011852 priority Critical patent/WO2016114797A1/en
Publication of WO2016114797A1 publication Critical patent/WO2016114797A1/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/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
    • G06F16/2255Hash tables

Definitions

  • a system may provide an interface for performing a similarity search of digital images stored in a repository.
  • Such a system may store images and allow a client to submit an image query that requests the system to return images in the data set that are similar to the image in the image query.
  • the system may then compare the image in the image query against selected images in the data set to identify images in the repository that are similar to the image in the image query.
  • FIG. 1 is a block diagram illustrating a similarity search computer system, in accordance with an example
  • FIG. 2 is a flowchart showing a method for building R-indexes operable according to shared intermediate hash values, according to an example
  • FIG. 3 is a diagram illustrating R-indexes built to be operable with a shared intermediate hash value, according to an example.
  • FIG. 4 is a flowchart showing a method for performing a search using shared intermediate hash values, according to an example.
  • This disclosure discusses, among other things, methods, systems, and computer-readable storage devices that may use shared intermediate hash values in similarity searches.
  • One technique implemented by systems for performing a similarity search may be to compute the distance between a query point and each of the points in the data set, while keeping track of the N closest points found.
  • N may be referred to as a result size threshold.
  • a result size threshold may identify a lower limit for the number candidate items a search results may return by a search query.
  • the search approach described above may be referred to as a naive search. Naive search approaches may be too slow for applications that require near-real-time responses because these searches can involve computationally intensive comparisons between many data points.
  • An approach to speed up a similarity search is to construct an index (referred to herein as an "R-index”) offline that returns, within a determinable confidence interval, the points within the data set that are within a specified distance (referred to herein as an "index distance threshold” or, in some cases, "R”) from any given query point.
  • R-index an index
  • this system can use the index to return points in the data set that are within the index distance threshold of the query with high probability.
  • the closest N points can be identified by a naive search over the set returned by the index to determine the closest data points in the data set.
  • Such an index can be constructed using locality sensitivity hashing (LSH).
  • an index can include multiple hash tables, and the system can aggregate the results of each hash table in identifying the search results.
  • Each of the hash tables of an index may be constructed using a respective hash function parameterized such that data points that are within a determinable distance are mapped together with a high likelihood.
  • a hash table within an R-index may be referred to as an R-hash table.
  • index distance threshold for the index is too small, then the system may fail to retrieve N points that are close to the query and, as a result, the entire set S may be searched by the system to identify IM data points.
  • the index distance threshold for the index is too large, then the set of retrieved data points might be too large for a meaningful speed-up in search time.
  • a single index distance threshold, however well chosen, may be inadequate. Therefore, some systems may use multiple indexes that each corresponds to a different index distance threshold.
  • an index associated with an index distance threshold may be referred to as an R-index.
  • a system using multiple R-indexes may operate according to the following procedure. First, the system may begin by retrieving points from an R- index associated with a first distance (R1 ). If N points returned by the first R- index are within the first distance, the search can terminate. If not, the search can proceed by searching a second R-index which corresponds to a second distance (R2), and so on until the N closest points are discovered.
  • R1 first distance
  • R2 second distance
  • the system can speed up the search for a much wider range of queries in terms of their distance to their nearest neighbors.
  • performing the search in this manner increases computation because a hash function (or hash functions) is executed for each R-index (or R-hash table). This affects the overall speed of the search because each hash function can involve computationally intensive processing.
  • Examples discussed in the foregoing may be used to reduce the computation needs for accessing indexes (or R-hash tables) across R values. That is, examples may leverage shared computation across different R-indexes.
  • This shared computation may be referred to herein as a "shared intermediate hash value.”
  • the term "shared intermediate hash value" may refer to an intermediate computation of a hash function that is shared across hash functions of different R-indexes. Accordingly, the shared computation performed in generating the shared intermediate hash value is computed once for multiple R-indexes.
  • a hash function may be parameterized.
  • the hash function parameters used to generate an R-hash table may be stored by the system.
  • Hash function parameters may be data or logic that may be used to alter or otherwise vary the execution of a hash function. An instance of a hash function may be said to be instantiated by a selection of the hash function parameters.
  • a data item (e.g., a vector of coordinate values) from a query submitted from a client device may be received.
  • a shared intermediate hash value may be computed from the data item and a first stored hash function parameter.
  • a first set of candidate results stored in a first R-hash table may be obtained based on a computation using the shared intermediate hash value and a second stored hash function parameter.
  • a second set of candidate results stored in a second R-hash table may be retrieved based on a computation using the shared intermediate hash value and a third stored hash function parameter.
  • the second set of candidate results may be returned to the client device based on a determination that the second set of candidate results meets the result size threshold.
  • a device may comprise a processor a machine- readable storage device that includes instructions that, when executed, cause the processor to add a data point from a data set to an entry within a first R- hash table using a first hash function and a hash function parameter.
  • the entry within the first R-hash table may identify other data points within the data store that are close to each other (e.g., within a constant factor times the given index distance threshold), although the entry may include yet other data points are not close to each other (e.g., outside a constant factor times the given index distance threshold).
  • the instructions may cause the processor to add the data point from the data set to an entry within a second R-hash table using a second hash function and the hash function parameter.
  • the entry within the second R-hash table may identify other data points within the data store that are within a second index distance threshold from the data point.
  • a data item may be received.
  • the data item may be represented by a vector of coordinate values.
  • the first R-hash table may be associated with a first index distance range.
  • the second R-hash table may be associated with a second index distance range.
  • a shared intermediate hash value from the vector of coordinate value and the hash function parameters may be generated.
  • a first set of candidate results stored in the first table using a first hash value derived from the shared intermediate hash value may be obtained.
  • the first set of candidate results may be returned to the client device.
  • FIG. 1 is a block diagram illustrating a similarity search computer system 100, in accordance with an example.
  • the similarity search computer system 100 may include a processor 141 and a computer-readable storage device 142.
  • the processor 141 may be a device suitable to read and execute processor executable instructions, such as a central processing unit (CPU), or an integrated circuit configured to perform a configured function.
  • the processor executable instructions may cause the processor 141 to implement techniques described herein.
  • the processor 141 may execute instructions for executing operations discussed in the foregoing.
  • the processor 141 may be coupled to the computer-readable storage device 142.
  • the computer-readable storage device 142 may contain thereon a set of instructions, which when executed by the processor 141 , cause the processor 141 to execute the techniques described herein.
  • the computer-readable storage device 142 may include the R-index generator instructions 144 and shared intermediate hash value query engine instructions 146.
  • R-index generator instructions 144 execution of the instructions 144, whole or in part, may cause the processor 141 to generate R-indexes that are capable of being indexed using shared intermediate hash values. Building the R-indexes is described in greater detail below with reference, for example, to FIGS. 2 and 3.
  • execution of the instructions 146 may cause the processor 141 to perform a similarity search on R-indexes using shared intermediate hash values.
  • the instructions may cause the processor 141 to receive a data item represented by a vector of coordinates.
  • the processor may then obtain hash function parameters previously used to generate a first R-hash table and a second R-hash table.
  • the first R-hash table may be associated with a first index distance threshold
  • the second table may be associated with a second index distance threshold.
  • the processor may then generate a shared intermediate hash value from the vector of coordinates and the hash function parameters.
  • the processor can retrieve a set of candidate results stored in the first R-hash table using a hash value derived from the shared intermediate hash value.
  • the processor can also return the set of candidate results to the client device.
  • Other cases of performing similarity searches on the R-indexes using shared intermediate hash values is described in greater detail below with reference, for example, to FIG. 4.
  • the computer-readable storage device 142 may also include data or logic such as R-indexes 150 and hash function parameters 152.
  • the R-indexes 150 may be indexes that associate a hashed value with data points that represent items in a data store.
  • Each R-index may include multiple hash tables that map hash values to data points such that some of data points associated with a hash value are close to each other, which may be measured according to a function of an index distance threshold (e.g., a constant factor times the given index distance threshold). Different R-indexes may be associated with different index distance thresholds.
  • the hash function parameters 152 may be hash parameters that were used to populate the different R-indexes. In some cases, the hash parameters may be the same across different R-indexes. In some cases, the hash parameters may be specific for a given R-hash table. The hash parameters are described in greater detail below.
  • FIG. 2 is a flowchart showing a method 200 for building R-indexes operable according to shared intermediate hash values, according to an example.
  • the method 200 may be performed by the modules, components, systems shown in FIG. 1 , such as a similarity search computer system, and, accordingly, is described herein merely by way of reference thereto. It will be appreciated that the method 200 may, however, be performed on any suitable hardware.
  • an R-index may include multiple R-hash tables that each correspond to the distance threshold of the R-index.
  • an R-hash table may be a hash table that is populated using a hash function that associates points that are likely to be within a given index distance threshold.
  • multiple R-hash tables may be built for an R-index to increase the confidence that the aggregated points returned from the R-index includes the points within the data set that are within the index distance threshold. Accordingly, the method 200 may be repeated for each R-hash table in the R-indexes.
  • the method 200 may begin at operation 202 when the similarity search computer system adds a data point from a data set to an entry within a first R-hash table using a first hash function and a hash function parameter.
  • the entry within the first R-hash table may identify some other data points within the data store that are within a function of the given index distance threshold (e.g., a constant factor times the given index distance threshold) from the data point, say R1.
  • the similarity search computer system adds the data point from the data set to an entry within a second R-hash table using a second hash function and the hash function parameter.
  • the entry within the second R- hash table may identify some other data points within the data store that are within a function of a second index distance threshold (e.g., (e.g., a constant factor times the given index distance threshold)) from the data point, say R2, where R1 ⁇ R2.
  • a second index distance threshold e.g., (e.g., a constant factor times the given index distance threshold)
  • FIG. 3 is a diagram illustrating R-indexes built to be operable with a shared intermediate hash value, according to an example.
  • the R-indexes 302, 304 each consist of a number of R-hash tables, 312a-i, 314a-i, respectively.
  • Each R-hash table can be constructed using multiple LSH functions to generate a key into the hash table.
  • a LSH function referred to as h a,b , maps d-dimensional vectors (e.g., a data item) to an integer.
  • the integers formed from the various h a b may be usable as a key to entries within an R-hash table.
  • h a b may be parameterized by a, a d-dimensional vector, and b, a real-valued number.
  • k random pairs (a,b) are generated, k, as used herein, refers to the dimensionality of the key used to index into an R-hash table.
  • k refers to the dimensionality of the key used to index into an R-hash table.
  • h a b (x) is computed for each point x in the data set that is to be made searchable, where h aJ> is the random hash function associated with the pair
  • a is a constant (e.g. 3) and I. J is the floor function.
  • the vector a and the real number b are selected independently at random k times.
  • the vector of coordinates of the vector a can be selected independently according to a normal distribution with zero mean and unit variance.
  • the vector b can be selected according to a uniform distribution over the interva Equivalents, the similarity search computer
  • system may use the following hash function to generate the hash tables:
  • a hash table may map a set of candidate results to an entry of the hash table based on a likelihood that the set of candidate results are within a function of an index distance threshold (e.g., a constant factor times the given index distance threshold) from each other.
  • an index distance threshold e.g., a constant factor times the given index distance threshold
  • the similarity search computer system may store the a, b values used to generate the R-hash tables.
  • the techniques described above for building R-indexes may be performed by the similarity search computer system in an offline fashion.
  • the similarity search computer system may operate at designated times to process a data store to build the hash tables for the different R values.
  • FIG. 4 is a flowchart showing a method 400 for performing a search using shared intermediate hash values, according to an example.
  • the method 400 may be performed by the modules, components, systems shown in FIG. 1 , such as a similarity search computer system, and, accordingly, is described herein merely by way of reference thereto. It will be appreciated that the method 400 may, however, be performed on any suitable hardware.
  • FIG. 4 illustrates that the method 400 may begin at operation 402 when a similarity search computer system receives a data item from a query submitted from a client device.
  • the data item may be
  • the data item may represent any other suitable data item that can be expressed as a vector of values or properties.
  • the similarity search system may generate a shared intermediate hash value from the data item and a stored hash function parameter.
  • the stored function parameter may be one of the hash function parameters stored with a hash table when the hash table was built.
  • the hash function parameter may be randomly generated a, b values previously used to build and populate the R-hash tables.
  • a may be a vector value of dimensionality matching the data item.
  • the similarity search system may calculate the shared intermediate hash value according to the following operation:
  • operation 404 may be performed for each of the hash functions that were used to generate the R-hash tables for the corresponding index distance threshold.
  • operation 404 may generate multiple shared intermediate hash values (e.g., a.x), one for each of the hash functions used to generate a mapping from a data item to an entry in the R-hash table.
  • a first iteration of operation 404 may generate a first co-ordinate of a multi-dimensional hash value that indexes into the entry of the first R-hash table, while a second iteration of operation 404 may generate an additional shared intermediate hash value usable to generate a second coordinate for the multi-dimensional hash value.
  • the similarity search system may retrieve a first set of candidate results stored in a R-hash table based on a computation using the shared intermediate hash value and a second stored hash function parameter (e.g., b, which, as discussed above, may be a real valued number). For example, the similarity search system may generate a value based on the following hash function:
  • A(x) is the shared intermediate hash value
  • b is a stored hash function parameter
  • a is a constant value
  • Rj is an index distance threshold for the current R-index
  • L.J is a floor function.
  • the similarity search system may retrieve another set of candidate results stored in another R-hash table based on a computation using the shared intermediate hash value and a third stored hash function parameter (e.g., b, which may be the same or different value from the second stored hash function parameter used in operation 406).
  • the R-hash table used at operation 408 may correspond to an index distance threshold that is different than the R-hash table used at operation 406.
  • the similarity search system may progressively search for candidate results using R-indexes corresponding to increasing index distance thresholds.
  • the similarity search system may avoid having to re-compute hash parameters used by hash functions for different R-hash tables across different R-indexes.
  • the similarity search system may return the set of candidate results retrieved at operation 408 to the client device based on a determination that the set of candidate results meets the result size threshold.
  • the similarity search system may perform a naive search of the candidate search results to determine which of the candidate results are within an index distance threshold assigned to the other R-hash table. The candidate results that are outside of the index distance threshold may be pruned or otherwise removed from the candidate results.
  • the similarity search system uses just one R-hash table per R-index but accesses many of the hash buckets in that table.
  • the query x is perturbed by random vectors ⁇ and the points corresponding to each of the values is retrieved. For example, perturbing the query x, the
  • the similarity search system may add deltas to x.
  • the similarity search system can also construct more than one R-hash table and perturb the query for each R- hash table an appropriate number of times.
  • the ⁇ vectors are selected by choosing the coordinates to be independent unit normal and then scaling ⁇ so that its norm is R j .
  • the similarity search system may, instead of scaling ⁇ so that its norm is R ⁇ , scale ⁇ so that its norm is 1. Then, for each of the ⁇ S values, the similarity search system can pre- compute:
  • This pre-computation approach can, in some cases, speed up the hash computation time significantly, especially when the dimensionality d of the points is very large. To see this, consider the following time complexity with and without pre-computation. Suppose a query is resolved after m indexes are resolved. In the absence of pre-computation, the number of computations may be where is the number of perturbations per table, k is
  • the number of computations may be where the first term corresponds to the computation of while the second term corresponds to the computation of using

Landscapes

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

Abstract

A method, system, and computer-readable storage device for performing a similarity search on data items. In one aspect, a data item may be received. The data item may be represented by a vector of coordinate value. Hash function parameters previously used to generate a first R-hash table and a second R-hash table may be obtained. The first R-hash table may be associated with a first index distance range. The second R-hash table may be associated with a second index distance range. A shared intermediate hash value from the vector of coordinate value and the hash function parameters may be generated. A first set of candidate results stored in the first R-hash table using a first hash value derived from the shared intermediate hash value may be obtained. The first set of candidate results may be returned to the client device.

Description

SHARED INTERMEDIATE HASH VALUES
BACKGROUND
[0001] Many different computer implemented applications use techniques for determining whether a data item is similar to another data item. These computer implemented processes may include, among other things, machine learning, computer vision, data mining, and information retrieval. By way of example, a system may provide an interface for performing a similarity search of digital images stored in a repository. Such a system may store images and allow a client to submit an image query that requests the system to return images in the data set that are similar to the image in the image query. Using the similarity search, the system may then compare the image in the image query against selected images in the data set to identify images in the repository that are similar to the image in the image query.
BRIEF DESCRIPTION OF DRAWINGS
[0002] Examples are described in detail in the following description with reference to implementations shown in the following figures:
[0003] FIG. 1 is a block diagram illustrating a similarity search computer system, in accordance with an example;
[0004] FIG. 2 is a flowchart showing a method for building R-indexes operable according to shared intermediate hash values, according to an example;
[0005] FIG. 3 is a diagram illustrating R-indexes built to be operable with a shared intermediate hash value, according to an example; and
[0006] FIG. 4 is a flowchart showing a method for performing a search using shared intermediate hash values, according to an example.
DETAILED DESCRIPTION
[0007] This disclosure discusses, among other things, methods, systems, and computer-readable storage devices that may use shared intermediate hash values in similarity searches.
[0008] One technique implemented by systems for performing a similarity search may be to compute the distance between a query point and each of the points in the data set, while keeping track of the N closest points found. Here, N may be referred to as a result size threshold. A result size threshold may identify a lower limit for the number candidate items a search results may return by a search query. The search approach described above may be referred to as a naive search. Naive search approaches may be too slow for applications that require near-real-time responses because these searches can involve computationally intensive comparisons between many data points.
[0009] An approach to speed up a similarity search is to construct an index (referred to herein as an "R-index") offline that returns, within a determinable confidence interval, the points within the data set that are within a specified distance (referred to herein as an "index distance threshold" or, in some cases, "R") from any given query point. Thus, upon receiving a given query, this system can use the index to return points in the data set that are within the index distance threshold of the query with high probability. Further, if there are N data points within the data points returned from the index, the closest N points can be identified by a naive search over the set returned by the index to determine the closest data points in the data set. Such an index can be constructed using locality sensitivity hashing (LSH).
[0010] Further, to improve the confidence interval of an index, an index can include multiple hash tables, and the system can aggregate the results of each hash table in identifying the search results. Each of the hash tables of an index may be constructed using a respective hash function parameterized such that data points that are within a determinable distance are mapped together with a high likelihood. A hash table within an R-index may be referred to as an R-hash table. [0011] Indexing in this manner can work well at speeding up the search provided that the points returned by the index do not include too many points whose distance from the query is greater than the index distance threshold. However, the choice of the index distance threshold can impact the speed-up for the search. If the index distance threshold for the index is too small, then the system may fail to retrieve N points that are close to the query and, as a result, the entire set S may be searched by the system to identify IM data points. On the other hand, if the index distance threshold for the index is too large, then the set of retrieved data points might be too large for a meaningful speed-up in search time. For many real-life data sets, a single index distance threshold, however well chosen, may be inadequate. Therefore, some systems may use multiple indexes that each corresponds to a different index distance threshold. As discussed above, an index associated with an index distance threshold may be referred to as an R-index.
[0012] A system using multiple R-indexes may operate according to the following procedure. First, the system may begin by retrieving points from an R- index associated with a first distance (R1 ). If N points returned by the first R- index are within the first distance, the search can terminate. If not, the search can proceed by searching a second R-index which corresponds to a second distance (R2), and so on until the N closest points are discovered.
[0013] By selecting the index distance thresholds appropriately, the system can speed up the search for a much wider range of queries in terms of their distance to their nearest neighbors. However, performing the search in this manner increases computation because a hash function (or hash functions) is executed for each R-index (or R-hash table). This affects the overall speed of the search because each hash function can involve computationally intensive processing.
[0014] Examples discussed in the foregoing may be used to reduce the computation needs for accessing indexes (or R-hash tables) across R values. That is, examples may leverage shared computation across different R-indexes. This shared computation may be referred to herein as a "shared intermediate hash value." The term "shared intermediate hash value" may refer to an intermediate computation of a hash function that is shared across hash functions of different R-indexes. Accordingly, the shared computation performed in generating the shared intermediate hash value is computed once for multiple R-indexes. In some cases, a hash function may be parameterized. The hash function parameters used to generate an R-hash table may be stored by the system. Hash function parameters may be data or logic that may be used to alter or otherwise vary the execution of a hash function. An instance of a hash function may be said to be instantiated by a selection of the hash function parameters.
[0015] To illustrate one aspect contemplated by this disclosure, a data item (e.g., a vector of coordinate values) from a query submitted from a client device may be received. A shared intermediate hash value may be computed from the data item and a first stored hash function parameter. A first set of candidate results stored in a first R-hash table may be obtained based on a computation using the shared intermediate hash value and a second stored hash function parameter. Based on a determination that the first set of candidate results fail to meet a result size threshold, a second set of candidate results stored in a second R-hash table may be retrieved based on a computation using the shared intermediate hash value and a third stored hash function parameter. The second set of candidate results may be returned to the client device based on a determination that the second set of candidate results meets the result size threshold.
[0016] In another aspect, a device may comprise a processor a machine- readable storage device that includes instructions that, when executed, cause the processor to add a data point from a data set to an entry within a first R- hash table using a first hash function and a hash function parameter. The entry within the first R-hash table may identify other data points within the data store that are close to each other (e.g., within a constant factor times the given index distance threshold), although the entry may include yet other data points are not close to each other (e.g., outside a constant factor times the given index distance threshold). Further, the instructions may cause the processor to add the data point from the data set to an entry within a second R-hash table using a second hash function and the hash function parameter. The entry within the second R-hash table may identify other data points within the data store that are within a second index distance threshold from the data point.
[0017] In yet another aspect, a data item may be received. The data item may be represented by a vector of coordinate values. Hash function
parameters previously used to generate a first R-hash table and a second R- hash table may be obtained. The first R-hash table may be associated with a first index distance range. The second R-hash table may be associated with a second index distance range. A shared intermediate hash value from the vector of coordinate value and the hash function parameters may be generated. A first set of candidate results stored in the first table using a first hash value derived from the shared intermediate hash value may be obtained. The first set of candidate results may be returned to the client device.
[0018] These and other examples are now described in greater detail.
[0019] FIG. 1 is a block diagram illustrating a similarity search computer system 100, in accordance with an example. The similarity search computer system 100 may include a processor 141 and a computer-readable storage device 142. The processor 141 may be a device suitable to read and execute processor executable instructions, such as a central processing unit (CPU), or an integrated circuit configured to perform a configured function. The processor executable instructions may cause the processor 141 to implement techniques described herein. For example the processor 141 may execute instructions for executing operations discussed in the foregoing.
[0020] The processor 141 may be coupled to the computer-readable storage device 142. The computer-readable storage device 142 may contain thereon a set of instructions, which when executed by the processor 141 , cause the processor 141 to execute the techniques described herein. For example, the computer-readable storage device 142 may include the R-index generator instructions 144 and shared intermediate hash value query engine instructions 146.
[0021] With regards to the R-index generator instructions 144, execution of the instructions 144, whole or in part, may cause the processor 141 to generate R-indexes that are capable of being indexed using shared intermediate hash values. Building the R-indexes is described in greater detail below with reference, for example, to FIGS. 2 and 3.
[0022] With regards to the shared intermediate hash value query engine instructions 146, execution of the instructions 146, whole or in part, may cause the processor 141 to perform a similarity search on R-indexes using shared intermediate hash values. For example, the instructions may cause the processor 141 to receive a data item represented by a vector of coordinates. The processor may then obtain hash function parameters previously used to generate a first R-hash table and a second R-hash table. The first R-hash table may be associated with a first index distance threshold, and the second table may be associated with a second index distance threshold. The processor may then generate a shared intermediate hash value from the vector of coordinates and the hash function parameters. The processor can retrieve a set of candidate results stored in the first R-hash table using a hash value derived from the shared intermediate hash value. The processor can also return the set of candidate results to the client device. Other cases of performing similarity searches on the R-indexes using shared intermediate hash values is described in greater detail below with reference, for example, to FIG. 4.
[0023] As FIG. 1 shows, the computer-readable storage device 142 may also include data or logic such as R-indexes 150 and hash function parameters 152. The R-indexes 150 may be indexes that associate a hashed value with data points that represent items in a data store. Each R-index may include multiple hash tables that map hash values to data points such that some of data points associated with a hash value are close to each other, which may be measured according to a function of an index distance threshold (e.g., a constant factor times the given index distance threshold). Different R-indexes may be associated with different index distance thresholds.
[0024] The hash function parameters 152 may be hash parameters that were used to populate the different R-indexes. In some cases, the hash parameters may be the same across different R-indexes. In some cases, the hash parameters may be specific for a given R-hash table. The hash parameters are described in greater detail below.
[0025] Operations of a similarity search computer system are now discussed. FIG. 2 is a flowchart showing a method 200 for building R-indexes operable according to shared intermediate hash values, according to an example. The method 200 may be performed by the modules, components, systems shown in FIG. 1 , such as a similarity search computer system, and, accordingly, is described herein merely by way of reference thereto. It will be appreciated that the method 200 may, however, be performed on any suitable hardware.
[0026] Before discussing the method 200 in greater detail, it is to be appreciated that an R-index may include multiple R-hash tables that each correspond to the distance threshold of the R-index. For example, as described above, an R-hash table may be a hash table that is populated using a hash function that associates points that are likely to be within a given index distance threshold. In some cases, multiple R-hash tables may be built for an R-index to increase the confidence that the aggregated points returned from the R-index includes the points within the data set that are within the index distance threshold. Accordingly, the method 200 may be repeated for each R-hash table in the R-indexes.
[0027] The method 200 may begin at operation 202 when the similarity search computer system adds a data point from a data set to an entry within a first R-hash table using a first hash function and a hash function parameter. The entry within the first R-hash table may identify some other data points within the data store that are within a function of the given index distance threshold (e.g., a constant factor times the given index distance threshold) from the data point, say R1.
[0028] At operation 204, the similarity search computer system adds the data point from the data set to an entry within a second R-hash table using a second hash function and the hash function parameter. The entry within the second R- hash table may identify some other data points within the data store that are within a function of a second index distance threshold (e.g., (e.g., a constant factor times the given index distance threshold)) from the data point, say R2, where R1 < R2.
[0029] The method 200 is now described using an example that utilizes a LSH scheme for building R-indexes. For example, FIG. 3 is a diagram illustrating R-indexes built to be operable with a shared intermediate hash value, according to an example. The R-indexes 302, 304 each consist of a number of R-hash tables, 312a-i, 314a-i, respectively. Each R-hash table can be constructed using multiple LSH functions to generate a key into the hash table. A LSH function, referred to as ha,b, maps d-dimensional vectors (e.g., a data item) to an integer. The integers formed from the various ha b may be usable as a key to entries within an R-hash table.
[0030] Further, ha b may be parameterized by a, a d-dimensional vector, and b, a real-valued number. To construct a hash table, k random pairs (a,b) are generated, k, as used herein, refers to the dimensionality of the key used to index into an R-hash table. Thus, each R-table in an R-index will be associated with k different hash functions that transform a data item to a key usable as a look-up key for an entry in the R-hash table.
[0031] ha b(x) is computed for each point x in the data set that is to be made searchable, where haJ> is the random hash function associated with the pair
(a. b).
[0032] Given a d-dimensional input real valued vector x = (x1 , x2 xd), one of the LSH functions ha,b, corresponding to an index It built for distance Rj maps it to an integer according to:
Figure imgf000010_0001
[0033] where a is a constant (e.g. 3) and I. J is the floor function. To generate k hash functions, the vector a and the real number b are selected independently at random k times. The vector of coordinates of the vector a can be selected independently according to a normal distribution with zero mean and unit variance. The vector b can be selected according to a uniform distribution over the interva Equivalents, the similarity search computer
Figure imgf000011_0002
system may use the following hash function to generate the hash tables:
Figure imgf000011_0001
[0034] where b is drawn uniformly over the interval [0,1 /a] . The values of k and L, where L is the number of R-hash tables in a given R-index, can be selected to achieve an acceptable false positive rate for each hash table and the required probability that a point within R} is retrieved. Thus, a hash table may map a set of candidate results to an entry of the hash table based on a likelihood that the set of candidate results are within a function of an index distance threshold (e.g., a constant factor times the given index distance threshold) from each other.
[0035] This disclosure notes that although a, b can be selected
independently at random for each of the k hash functions and corresponding R- hash tables for a single R range, examples discussed herein may relax the independence of the values of a and b across different indexes of different R values. Therefore, in these examples, the a, b values can be generated only once for an initial R value and then reused across the indexes generated for other R values. As is discussed below, this allows some examples to pre- compute some parameters (e.g., shared intermediate hash values) of the hash function. However, as it relates to building the R-hash tables, the similarity search computer system may store the a, b values used to generate the R-hash tables.
[0036] The techniques described above for building R-indexes may be performed by the similarity search computer system in an offline fashion. Thus, according to some examples, the similarity search computer system may operate at designated times to process a data store to build the hash tables for the different R values.
[0037] The runtime operation of performing a similarity search is now described in greater detail. For example, FIG. 4 is a flowchart showing a method 400 for performing a search using shared intermediate hash values, according to an example. The method 400 may be performed by the modules, components, systems shown in FIG. 1 , such as a similarity search computer system, and, accordingly, is described herein merely by way of reference thereto. It will be appreciated that the method 400 may, however, be performed on any suitable hardware.
[0038] FIG. 4 illustrates that the method 400 may begin at operation 402 when a similarity search computer system receives a data item from a query submitted from a client device. In some cases, the data item may be
represented as a vector of coordinate values. By way of example and not limitation, such may be the case where the data item represents some portion of digital image. However, in other examples, the data item may represent any other suitable data item that can be expressed as a vector of values or properties.
[0039] At operation 404, the similarity search system may generate a shared intermediate hash value from the data item and a stored hash function parameter. In some cases, the stored function parameter may be one of the hash function parameters stored with a hash table when the hash table was built. For example, as discussed above in an LSH scheme using an Euclidian distance function, the hash function parameter may be randomly generated a, b values previously used to build and populate the R-hash tables. As may be recalled a may be a vector value of dimensionality matching the data item. In such a case, the similarity search system may calculate the shared intermediate hash value according to the following operation:
Figure imgf000012_0001
[0040] In the above operation generates a value from the inner product of the stored R-hash table vector a and the data item x.
[0041] It is to be appreciated that operation 404 may be performed for each of the hash functions that were used to generate the R-hash tables for the corresponding index distance threshold. Thus, in some cases, operation 404 may generate multiple shared intermediate hash values (e.g., a.x), one for each of the hash functions used to generate a mapping from a data item to an entry in the R-hash table. In this case, a first iteration of operation 404 may generate a first co-ordinate of a multi-dimensional hash value that indexes into the entry of the first R-hash table, while a second iteration of operation 404 may generate an additional shared intermediate hash value usable to generate a second coordinate for the multi-dimensional hash value.
[0042] At operation 406, the similarity search system may retrieve a first set of candidate results stored in a R-hash table based on a computation using the shared intermediate hash value and a second stored hash function parameter (e.g., b, which, as discussed above, may be a real valued number). For example, the similarity search system may generate a value based on the following hash function:
Figure imgf000013_0001
[0043] As discussed above A(x) is the shared intermediate hash value, b is a stored hash function parameter, a is a constant value, Rj is an index distance threshold for the current R-index, and L.J is a floor function.
[0044] At operation 408, based on a determination that the set of candidate results retrieved at operation 406 fails to meet a result size threshold, the similarity search system may retrieve another set of candidate results stored in another R-hash table based on a computation using the shared intermediate hash value and a third stored hash function parameter (e.g., b, which may be the same or different value from the second stored hash function parameter used in operation 406). The R-hash table used at operation 408 may correspond to an index distance threshold that is different than the R-hash table used at operation 406. Thus, the similarity search system may progressively search for candidate results using R-indexes corresponding to increasing index distance thresholds. However, in some cases, by using the shared intermediate hash value, the similarity search system may avoid having to re-compute hash parameters used by hash functions for different R-hash tables across different R-indexes. [0046] At operation 410, the similarity search system may return the set of candidate results retrieved at operation 408 to the client device based on a determination that the set of candidate results meets the result size threshold. To determine that the set of candidate results meets the result size threshold, the similarity search system may perform a naive search of the candidate search results to determine which of the candidate results are within an index distance threshold assigned to the other R-hash table. The candidate results that are outside of the index distance threshold may be pruned or otherwise removed from the candidate results.
[0046] Sometimes, the number of R-hash tables used in each R-index used to achieve a given probability of retrieval can be too large. Therefore, some examples of the similarity search system uses just one R-hash table per R-index but accesses many of the hash buckets in that table. Specifically, the query x is perturbed by
Figure imgf000014_0003
random vectors δ and the points corresponding to each of the values is retrieved. For example, perturbing the query x, the
Figure imgf000014_0002
system may add deltas to x. In other cases, the similarity search system can also construct more than one R-hash table and perturb the query for each R- hash table an appropriate number of times. The δ vectors are selected by choosing the coordinates to be independent unit normal and then scaling δ so that its norm is Rj. To compute a shared intermediate hash value, the similarity search system may, instead of scaling δ so that its norm is R}, scale δ so that its norm is 1. Then, for each of the <S values, the similarity search system can pre- compute:
Figure imgf000014_0001
[0048] This pre-computation approach can, in some cases, speed up the hash computation time significantly, especially when the dimensionality d of the points is very large. To see this, consider the following time complexity with and without pre-computation. Suppose a query is resolved after m indexes are resolved. In the absence of pre-computation, the number of computations may be
Figure imgf000015_0005
where is the number of perturbations per table, k is
Figure imgf000015_0006
the number of dimensions in the hash key, and L is the number of tables per index. On the other hand, with pre-computation, the number of computations may be
Figure imgf000015_0001
where the first term corresponds to the computation of
Figure imgf000015_0002
while the second term corresponds to the computation of using
Figure imgf000015_0003
Figure imgf000015_0004

Claims

CLAIMS What is claimed is:
1. A method comprising:
receiving, by a computer system, a data item from a query submitted from a client device;
generating, by the computer system, a shared intermediate hash value from the data item and a first stored hash function parameter;
retrieving, by the computer system, a first set of candidate results stored in a first R-hash table based on computing the shared intermediate hash value and a second stored hash function parameter;
based on a determination that the first set of candidate results fail to meet a result size threshold, retrieving, by the computer system, a second set of candidate results stored in a second R-hash table based on computing the shared intermediate hash value and a third stored hash function parameter; and returning, by the computer system, the second set of candidate results to the client device based on a determination that the second set of candidate results meets the result size threshold.
2. The method of claim 1, wherein the first set of candidate results map to an entry of the first R-hash table based on a likelihood that the first set of candidate results are within an index distance threshold from each other.
3. The method of claim 2, wherein computing the shared intermediate hash value and the second stored hash function parameter generates a first coordinate of a multi-dimensional hash value that indexes into the entry of the first R-hash table, and the method further comprises generating an additional shared intermediate hash value usable to generate a second coordinate for the multidimensional hash value.
4. The method of claim , wherein the first set of candidate results is stored in the R-hash table based on a likelihood that the first set of candidate results are within a function of the first index distance threshold from a point representing the data item, and the second set of candidate results is stored in the second R-hash table based on the likelihood that the second set of candidate results are within a function of the second index distance threshold from the point representing the data item.
5. The method of claim 1 , further comprising, prior to returning the second set of candidate results to the client device:
pruning a candidate result from the second set of candidate results based on the candidate result failing to meet an index distance threshold.
6. The method of claim 1 , comprising perturbing the data item before generating the shared intermediate hash value.
7. The method of claim 1, wherein the first stored hash function parameter is a vector with values selected at random when the first R-hash table was created.
8. A device comprising:
a processor; and
a machine-readable storage device comprising instructions that, when executed, cause the processor to:
add a data point from a data set to an entry within a first R- hash table using a first hash function and a hash function parameter, the entry within the first R-hash table identifying other data points within the data store that are within a function of a first index distance threshold from the data point; and
add the data point from the data set to an entry within a second R-hash table using a second hash function and the hash function parameter, the entry within the second R-hash table identifying other data points within the data store that are within a function of a second index distance threshold from the data point.
9. The device of claim 8, wherein the instructions, when executed, cause the processor further to store the hash function parameter corresponding to the first R-hash table and second R-hash table.
10. The device of claim 8, wherein the data point is represented by a vector of coordinate values.
11. The device of claim 10, wherein the first hash function and the hash function parameter maps the data point from the data set with the entry within the first R-hash table based on transforming the vector of coordinates to a value type usable as a lookup key in the first R-hash table.
12. A device comprising:
a processor; and
a machine-readable storage device comprising instructions that, when executed, cause the processor to:
receive a data item represented by a vector of coordinates; obtain hash function parameters previously used to generate a first R-hash table and a second R-hash table, the first R-hash table being associated with a first index distance threshold, the second R- hash table being associated with a second index distance threshold;
generate a shared intermediate hash value from the vector of coordinates and the hash function parameters;
retrieve a set of candidate results stored in the first R-hash table using a hash value derived from the shared intermediate hash value; and
return the set of candidate results to the client device.
13. The method of claim 12, wherein the instructions further cause the processor to, prior to returning the first set of candidate results to the client device, prune the first set of candidate results of candidate results failing to meet an index distance threshold.
14. The method of claim 12, wherein the first R-hash table and the second the second R-hash table are hash tables generated from a locality sensitivity hash (LSH).
15. The method of claim 12, wherein the first R-hash table is part of an R-index that includes other R-hash tables associated with the first index distance threshold.
ABSTRACT
A method, system, and computer-readable storage device for performing a similarity search on data items. In one aspect, a data item may be received. The data item may be represented by a vector of coordinate value. Hash function parameters previously used to generate a first R-hash table and a second R-hash table may be obtained. The first R-hash table may be associated with a first index distance range. The second R-hash table may be associated with a second index distance range. A shared intermediate hash value from the vector of coordinate value and the hash function parameters may
PCT/US2015/011852 2015-01-16 2015-01-16 Shared intermediate hash values Ceased WO2016114797A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/US2015/011852 WO2016114797A1 (en) 2015-01-16 2015-01-16 Shared intermediate hash values

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/US2015/011852 WO2016114797A1 (en) 2015-01-16 2015-01-16 Shared intermediate hash values

Publications (1)

Publication Number Publication Date
WO2016114797A1 true WO2016114797A1 (en) 2016-07-21

Family

ID=56406193

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/US2015/011852 Ceased WO2016114797A1 (en) 2015-01-16 2015-01-16 Shared intermediate hash values

Country Status (1)

Country Link
WO (1) WO2016114797A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374142A (en) * 2022-04-15 2022-11-22 北京理工大学 LSH-based direct query method for non-equivalent connectable data table

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100070509A1 (en) * 2008-08-15 2010-03-18 Kai Li System And Method For High-Dimensional Similarity Search
US20100135484A1 (en) * 2008-11-28 2010-06-03 Canon Kabushiki Kaisha Hash value calculation apparatus and method thereof
US20130230255A1 (en) * 2012-03-02 2013-09-05 Microsoft Corporation Image Searching By Approximate k-NN Graph
US20130254191A1 (en) * 2011-12-06 2013-09-26 The Trustees Of Columbia University In The City Of New York Systems and methods for mobile search using bag of hash bits and boundary reranking
EP2750047A1 (en) * 2012-12-28 2014-07-02 Sap Ag Hash table and radix sort based aggregation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100070509A1 (en) * 2008-08-15 2010-03-18 Kai Li System And Method For High-Dimensional Similarity Search
US20100135484A1 (en) * 2008-11-28 2010-06-03 Canon Kabushiki Kaisha Hash value calculation apparatus and method thereof
US20130254191A1 (en) * 2011-12-06 2013-09-26 The Trustees Of Columbia University In The City Of New York Systems and methods for mobile search using bag of hash bits and boundary reranking
US20130230255A1 (en) * 2012-03-02 2013-09-05 Microsoft Corporation Image Searching By Approximate k-NN Graph
EP2750047A1 (en) * 2012-12-28 2014-07-02 Sap Ag Hash table and radix sort based aggregation

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115374142A (en) * 2022-04-15 2022-11-22 北京理工大学 LSH-based direct query method for non-equivalent connectable data table
CN115374142B (en) * 2022-04-15 2025-12-19 北京理工大学 LSH-based non-equivalent connectable data table direct query method

Similar Documents

Publication Publication Date Title
US11048966B2 (en) Method and device for comparing similarities of high dimensional features of images
US12038896B2 (en) Data indexing and searching using permutation indexes
Kong et al. Isotropic hashing
US12405999B2 (en) Matching audio fingerprints
WO2020182019A1 (en) Image search method, apparatus, device, and computer-readable storage medium
CN108304409B (en) Carry-based data frequency estimation method of Sketch data structure
CN111026922B (en) A distributed vector indexing method, system, plug-in and electronic device
CN111033495B (en) Multi-scale quantization for fast similarity search
WO2022011851A1 (en) Method and device for evaluating metric space partitioning mode, computer device and storage medium
KR101435010B1 (en) Method for learning of sequential binary code using features and apparatus for the same
CN114218420B (en) Image retrieval acceleration method, retrieval device, electronic device and storage medium
Mathur et al. Vector search algorithms: A brief survey
CN112199408B (en) Reference distance similarity search
CN114020948B (en) Sketch image retrieval method and system based on sequencing cluster sequence discrimination selection
JP6495206B2 (en) Document concept base generation device, document concept search device, method, and program
WO2016114797A1 (en) Shared intermediate hash values
US11620269B2 (en) Method, electronic device, and computer program product for data indexing
Matsui et al. Pqtable: Nonexhaustive fast search for product-quantized codes using hash tables
Song et al. Efficient Reverse $ k $ Approximate Nearest Neighbor Search Over High-Dimensional Vectors
Weng et al. Fast Search on Binary Codes by Weighted Hamming Distance
Pardede et al. Comparison of similarity measures in HSV quantization for CBIR
Xie et al. Data-dependent locality sensitive hashing
Rattaphun et al. Indexing in k-Nearest Neighbor Graph by Hash-Based Hill-Climbing
US12591570B2 (en) Systems and methods for finding nearest neighbors
Ryu et al. Integrating feature analysis and background knowledge to recommend similarity functions

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: 15878234

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15878234

Country of ref document: EP

Kind code of ref document: A1