Skip to content

Commit

Permalink
Update Blog “batch-vector-search-with-qdrant”
Browse files Browse the repository at this point in the history
  • Loading branch information
mila.vasnetsova committed Jan 8, 2024
1 parent 0d0e647 commit 10ac4a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions qdrant-landing/content/blog/batch-vector-search-with-qdrant.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ There are a lot of scenarios in which you may need to perform multiple non-relat

Now, thanks to the new batch search, you don’t need to worry about that. Qdrant will handle multiple search requests in just one API call and will perform those requests in the most optimal way.

# An example of using the batch search
## An example of using the batch search

We’ve used the official Python client to show how the batch search might be integrated with your application. Since there have been some changes in the interfaces of Qdrant 0.10.0, we’ll go step by step.

# Creating the collection
## Creating the collection

The first step is to create a collection with a specified configuration — at least vector size and the distance function used to measure the similarity between vectors.

Expand All @@ -41,7 +41,7 @@ client.recreate_collection(
)
```

# Loading the vectors
## Loading the vectors

With the collection created, we can put some vectors into it. We’re going to have just a few examples.

Expand All @@ -64,7 +64,7 @@ client.upload_collection(
)
```

# Batch search in a single request
## Batch search in a single request

Now we’re ready to start looking for similar vectors, as our collection has some entries. Let’s say we want to find the distance between the selected vector and the most similar database entry and at the same time find the two most similar objects for a different vector query. Up till 0.9, we would need to call the API twice. Now, we can send both requests together:

Expand Down Expand Up @@ -99,7 +99,7 @@ Each instance of the SearchRequest class may provide its own search parameters,

And that’s it! You no longer have to handle the multiple requests on your own. Qdrant will do it under the hood.

# Benchmark
## Benchmark

The batch search is fairly easy to be integrated into your application, but if you prefer to see some numbers before deciding to switch, then it’s worth comparing four different options:

Expand All @@ -110,7 +110,7 @@ The batch search is fairly easy to be integrated into your application, but if y

In order to do that, we’ll create a richer collection of points, with vectors from the *glove-25-angular* dataset, quite a common choice for ANN comparison. If you’re interested in seeing some more details of how we benchmarked Qdrant, let’s take a [look at the Gist](https://gist.github.com/kacperlukawski/2d12faa49e06a5080f4c35ebcb89a2a3).

# The results
## The results

We launched the benchmark 5 times on 10000 test vectors and averaged the results. Presented numbers are the mean values of all the attempts:

Expand All @@ -123,6 +123,6 @@ The results you may achieve on a specific setup may vary depending on the hardwa

Additional improvements could be achieved in the case of distributed deployment, as Qdrant won’t need to make extensive inter-cluster requests. Moreover, if your requests share the same filtering condition, the query optimizer would be able to reuse it among batch requests.

# Summary
## Summary

Batch search allows packing different queries into a single API call and retrieving the results in a single response. If you ever struggled with sending several consecutive queries into Qdrant, then you can easily switch to the new batch search method and simplify your application code. As shown in the benchmarks, that may almost effortlessly speed up your interactions with Qdrant even by over 30%, even not considering the spare network overhead and possible reuse of filters!

0 comments on commit 10ac4a0

Please sign in to comment.