Comments (5)
Hi @jpbalarini, you'll see different results for queries that use an approximate index (docs). You can try increasing ef_construction
(and then m
if that doesn't work) to see if it improves recall.
Do you have a lot of duplicate embeddings? It's possible that could be contributing to poor recall.
from pgvector.
Just noticed you're using m = 4
and ef_construction = 10
. This is likely why recall is poor. Try using the defaults.
from pgvector.
Thanks @ankane . I found where I took those parameters from:
https://www.crunchydata.com/blog/hnsw-indexes-with-postgres-and-pgvector#tldr
No idea why they use those values.
Leaving the default values (partially) did the trick. I now get something that makes some sense, but I'm not getting the values that I need that are closer (0.84 and 0.82).
Without using the index (seq scan):
id | distance |
---|---|
e8bec92d-6d75-43c0-a397-cc223136eb98 | 0.8405799269676208 |
e8d2ff73-fd86-4216-99c8-7dcdbaca4c5b | 0.8213955163955688 |
f31dbe3f-026c-45ed-baeb-328f98bdbad5 | 0.8135669231414795 |
d6534c95-523d-4255-b2e7-4dc1758cf5f3 | 0.8135632872581482 |
... | ... |
Using the index:
id | distance |
---|---|
f31dbe3f-026c-45ed-baeb-328f98bdbad5 | 0.8135669231414795 |
d6534c95-523d-4255-b2e7-4dc1758cf5f3 | 0.8135632872581482 |
fa29f109-dac3-49e0-ada3-e176efeb71f2 | 0.8135602474212646 |
d09dffd7-1d7e-4e33-aaca-a66253ae9043 | 0.8135518431663513 |
... | ... |
I tried increasing the ef_construction
from 64 to 96, but the results were the same. I'm now trying with 128 (still building the index). Do you have something to recommend? Maybe trying to increase the m
size too?
Any recommendation is useful; thanks!
from pgvector.
I'd recommend calculating recall programmatically over many queries to quantify the difference between sets of parameters. The best parameters will be different for each dataset. I'd try ef_construction
= 64, 128, 256, and 512 (with m
= 16) and then m
= 32 and 64 (with ef_construction
being at least 4 * m
) until you reach your target recall.
from pgvector.
Thanks Andrew for your insights! I will try that 💪🏻
from pgvector.
Related Issues (20)
- Duplicate error when creating a vector index using HNSW HOT 6
- tuning the tmpCtx to improve HNSW build performance HOT 5
- Index vector_ip_ops does not work for halfvec HOT 1
- Can the "LIMIT" statement be included as one of arguments when doing scan operation? HOT 1
- SQL Error [XX000]: FATAL: failed to open bitcode file "/usr/local/lib/postgresql/bitcode/vector/src/vector.bc": No such file or directory HOT 4
- how to list existing databases in postgresql using python HOT 2
- HNSW Indexing and Filtering HOT 2
- A question about building index in background. HOT 1
- Installation instructions unclear HOT 1
- Large vector data type will cause performance decline? HOT 1
- A question regard table_open() in background worker when building index HOT 3
- jVector Implementation
- Type Error when working with Langchain (Missing Positional Argument: evalue) HOT 1
- pgvector still use row-based storage instead of columnar storage ? HOT 1
- Can't get the query planner to use HNSW index HOT 3
- 【search failed】 2000w、768dim, data search failed HOT 1
- ERROR: index row size 6160 exceeds btree version 4 maximum 2704 for index HOT 3
- Make difficulties HOT 2
- Table Insert Performance with HNSW Index HOT 2
- Comparison with high-precision data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pgvector.