From: lucagiac81 (@lucagiac81) <noreply+lucagiac81@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #531: Add AVX-512 FP16 implementation of halfvec distance functions
Date: Thu, 16 May 2024 19:36:13 +0000
Message-ID: <gh-pgvector-pgvector-531-c2116043999@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-531@github.com>
References: <gh-pgvector-pgvector-531@github.com>
Here are some initial results
- We made a few changes to ANN benchmarks to support halfvec (following your [post](https://jkatz05.com/post/postgres/pgvector-scalar-binary-quantization/)) and used the [default conditions](https://github.com/erikbern/ann-benchmarks/blob/main/ann_benchmarks/algorithms/pgvector/config.yml).
- The tests were run on an m7i.metal-24xl instance. pgvector is compiled with gcc-12.
- We measure query performance for the AVX-512 half-precision and single-precision distance implementations, and compare with the existing F16c implementation. To enable the half-precision functions, we use `SET halfvec.use_fp16_compute = true` in [set_query_arguments](https://github.com/erikbern/ann-benchmarks/blob/cc3a748305b2478838e84b8e625f9eb0beec993e/ann_benchma...), as described in the [previous comment](https://github.com/pgvector/pgvector/pull/531#issuecomment-2109199219).
With the gist-960-euclidean dataset, so far we observe
- qps increase of 9.6%-12.9% for half-precision and 1.4%-3.6% for single-precision
- p99 reduction of 8.3%-12.8% for half-precision and 0-4% for single-precision
- recall is matched to within +/-1% for both implementations
It'd be great if you could reproduce these numbers with your setup. Please let me know if you still run into compilation issues. We'd also like to collect data with dbpedia-openai-1000k-angular as well (higher dimensions, different distance metric) , but we're running into a 403 error when downloading the dataset (similar to this [report](https://github.com/erikbern/ann-benchmarks/issues/460)). Do you have any advice on how to run with that dataset?