Supabasegregnr,oli_rice,egor_romanovBenchmark
pgvector: Fewer dimensions are better
Summary
Embeddings support semantic search, retrieval augmented generation, and clustering in pgvector, but high-dimensional vectors increase storage, memory, and distance-computation costs as datasets grow. The post explains how IVF indexes reduce the records examined and compares embedding models using Massive Text Embedding Benchmark results, noting little correlation between dimension count and performance. In a 224,482-vector Wikipedia dataset, all-MiniLM-L6-v2 with 384 dimensions delivered 78% higher queries per second than OpenAI text-embedding-ada-002 with 1536 dimensions at accuracy@10 of 0.99, while using 4GB rather than 7.5GB of RAM. The 384-dimensional gte-small model produced more than a 200% queries-per-second improvement over all-MiniLM-L6-v2 at the same accuracy, though model choice still depends on task performance, sequence length, language support, and operational costs.
Context
High-dimensional embeddings create scaling challenges for pgvector: a 1536-dimensional vector is about 6.15 kilobytes, 1 million vectors require more than 6GB of raw storage, and similarity queries still perform substantial computation even with IVF indexes. The source also notes that vector workloads can lead to significant hardware underprovisioning.
Approach / What changed
The comparison evaluates lower-dimensional embedding models using MTEB results and a pgvector benchmark on 224,482 Wikipedia embeddings. It holds accuracy@10 at 0.99 while comparing queries per second for OpenAI text-embedding-ada-002, all-MiniLM-L6-v2, and gte-small under a fixed PostgreSQL, pgvector, hardware, dataset, and IVF configuration.
Takeaways
IVF indexes can reduce nearest-neighbor distance computations from the full dataset to roughly 5–20% in real-world use, but a 1-million-record dataset may still require 50,000–200,000 calculations per query.
MTEB results show models with fewer dimensions can perform comparably or better than text-embedding-ada-002; gte-small ranks above it while producing 384-dimensional vectors instead of 1536.
PCA and t-SNE may discard semantic information and become less valid when the distribution of embedded text shifts, because their learned representations are not inherently adaptable.
Source and freshness
- Source
- supabase.com
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.