pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: cho-thinkfree-com (@cho-thinkfree-com) <noreply+cho-thinkfree-com@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #521: Are either int8 or fp8 vectors planned?
Date: Mon, 25 Nov 2024 09:19:03 +0000
Message-ID: <gh-pgvector-pgvector-521-c2497372311@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-521@github.com>
References: <gh-pgvector-pgvector-521@github.com>

I am using 1024-dimensional vectors, and with millions of vector rows, the data size becomes a significant issue. Thanks to your recent work, iterable scanning for indexes is now possible, making it much easier to use HNSW indexes. (Thank you so much!) However, storage size remains a major concern for me.

I have considered using bits, but due to their low precision. Based on the content written by @xfalcox 
( https://github.com/pgvector/pgvector/issues/521#issuecomment-2061634539 ), the Top-5 hit rate for BIT is calculated to be approximately below 60%.

I am exploring whether there might be a better approach. I would like to know if you have any plans to integrate `intvec`, `e4m3`, or `e2m5` into the main branch as mentioned earlier.

Alternatively, I have been considering leveraging bits in the following way:

(Assuming each value in the vector is between 0 and 1:)

* Create an index by converting each vector value into 0 or 1 based on a threshold of 0.25.
* Create another index with a threshold of 0.50.
* Create yet another index with a threshold of 0.75.
* During a search, use these indexes to perform searches and combine the results to rank them.

Although this method is not ideal, I believe it could yield better results compared to using a single bit index. (Of course, I expect that creating these indexes would require significantly more CPU resources.)

Using four thresholds to create indexes might produce even better results, but it would consume a lot of CPU, and I feel this approach would lose its effectiveness if `intvec`, `e4m3`, or `e2m5` are eventually integrated.

(The following content is separate from int8 or fp8)
Another challenge is that this method would require processing each embedding result programmatically in a loop, converting values into 0 or 1 based on the respective thresholds. While this can be implemented programmatically, I am curious to know if there are any plans to support such functionality directly as a built-in function in pgvector.

Do you have any plans to introduce functionality like `binary_quantize(VECTOR, THRESHOLD)` in addition to the existing `binary_quantize(VECTOR)`?
(I feel sorry for always making requests without being able to contribute to the project.)


view thread (24+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-521-c2497372311@github.com>
Permalink:  ../gh-pgvector-pgvector-521-c2497372311@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