pg.ddx.io pgvector/pgvector GitHub issues and pull requestshelp / color / mirror / Atom feed
[pgvector/pgvector] issue #729: User-defined distance functions 5+ messages / 3 participants [nested] [flat]
* [pgvector/pgvector] issue #729: User-defined distance functions @ 2024-12-10 01:46 "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com> 0 siblings, 0 replies; 5+ messages in thread From: michaelbautin (@michaelbautin) @ 2024-12-10 01:46 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> It would be great to have a way to define custom distance functions and plug them into existing HNSW and IVFFlat implementations. As far as I can see, the current code already incurs Postgres function call overhead when computing the distance. ^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #729: User-defined distance functions @ 2024-12-10 01:56 "jkatz (@jkatz)" <noreply+jkatz@github.com> 3 siblings, 0 replies; 5+ messages in thread From: jkatz (@jkatz) @ 2024-12-10 01:56 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> What distance functions are you looking for? ^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #729: User-defined distance functions @ 2024-12-10 02:29 "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com> 3 siblings, 0 replies; 5+ messages in thread From: michaelbautin (@michaelbautin) @ 2024-12-10 02:29 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> I thought it would be great to override the distance function at least during prototyping/testing of user apps, and even evaluating various approaches for improving pgvector itself, for example, implementing product quantization outside of pgvector. A distance function could treat each coordinate of a uint8 vector as a centroid in a product quantization subspace, and the result would be computed based on such centroids of two quantized vectors. But I guess that specific use case would require support for int8/uint8 vectors first. In general, however, algorithms such as HNSW do not even require elements to be vectors. All that is required is a way to compute distance between two elements. For example, the [usearch](https://github.com/unum-cloud/usearch) C++ library fully abstracts the distance function. Postgres is not C++, of course, but it is also very extensible. Users are certainly very comfortable defining their own functions. ^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #729: User-defined distance functions @ 2024-12-10 14:44 "ankane (@ankane)" <noreply+ankane@github.com> 3 siblings, 0 replies; 5+ messages in thread From: ankane (@ankane) @ 2024-12-10 14:44 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi @michaelbautin, it's currently possible to do this (see https://github.com/pgvector/pgvector/issues/234#issuecomment-1703645894), but I don't think it's common enough to officially support. ^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #729: User-defined distance functions @ 2024-12-10 14:44 "ankane (@ankane)" <noreply+ankane@github.com> 3 siblings, 0 replies; 5+ messages in thread From: ankane (@ankane) @ 2024-12-10 14:44 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @ankane closed this. ^ permalink raw [nested|flat] 5+ messages in thread
end of thread, other threads:[~2024-12-10 14:44 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-12-10 01:46 [pgvector/pgvector] issue #729: User-defined distance functions "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com> 2024-12-10 01:56 ` "jkatz (@jkatz)" <noreply+jkatz@github.com> 2024-12-10 02:29 ` "michaelbautin (@michaelbautin)" <noreply+michaelbautin@github.com> 2024-12-10 14:44 ` "ankane (@ankane)" <noreply+ankane@github.com> 2024-12-10 14:44 ` "ankane (@ankane)" <noreply+ankane@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