pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
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: Tue, 14 May 2024 03:18:13 +0000
Message-ID: <gh-pgvector-pgvector-531-c2109199219@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-531@github.com>
References: <gh-pgvector-pgvector-531@github.com>

While collecting data with ANN benchmarks, we noticed a degradation in recall for some datasets (such as sift-128) when computing distances in half precision. Other datasets (such as gist-960) are not affected, and recall is matched to the existing distance functions. The existing functions (*F16c) first convert halfvec elements to single precision and execute the distance computation in single precision.

So, enabling the FP16 distance functions may not be desirable in all cases. The latest update to the PR provides two implementations of the distance functions with AVX-512: one using single precision and one using half precision.

- The single-precision functions are used by default, as they're the most generically applicable.
- The user can decide to use the half-precision functions by setting a variable (halfvec.use_fp16_compute). The decision should be based on recall vs performance tradeoff for a specific dataset (this implementation handles 2x the vector elements per iteration compared to the single-precision one). 

view thread (32+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-531-c2109199219@github.com>
Permalink:  ../gh-pgvector-pgvector-531-c2109199219@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox