LLM Evals or Unit Tests? — Why Your CI Pipeline Is Lying
Discover why treating LLM evaluations like unit tests creates false security in CI/CD pipelines. Learn regression-testing discipline and metric validation...
The notion that vector databases are "magic black boxes" stems from a lack of understanding about the underlying indexing algorithms that power these systems. In reality, vector databases rely on sophisticated algorithms to efficiently search and retrieve similar items. Two popular indexing algorithms used in vector databases are HNSW (Hierarchical Navigable Small World) and IVFFlat (Inverted File Flat). These algorithms have distinct trade-offs, and understanding their differences is crucial for effective use of vector databases.
HNSW and IVFFlat are both designed to efficiently search for similar vectors in high-dimensional spaces. However, they differ in their approach:
When choosing between HNSW and IVFFlat, consider the trade-offs between recall, memory usage, build time, and query performance.
When selecting an indexing algorithm for a vector database, it's essential to consider the trade-offs between recall, memory usage, and insert performance. HNSW offers high recall and efficient insertion, but at the cost of higher memory usage. IVFFlat, on the other hand, provides lower memory usage but may require periodic rebuilding and has lower recall.
Test your understanding of the fundamental differences between HNSW and IVFFlat:
The myth that all vector compression techniques are equally effective stems from a lack of understanding of the different techniques available and their varying trade-offs. Two popular techniques, Product Quantization (PQ) and Scalar Quantization (SQ), are often used for vector compression but work differently and have distinct advantages and disadvantages.
Product Quantization (PQ) is a technique that splits vectors into subspaces and quantizes each subspace independently. This approach enables high compression ratios, up to 64x, but can make distance calculations less efficient, particularly for SIMD (Single Instruction, Multiple Data) operations. On the other hand, Scalar Quantization (SQ) compresses each vector component from float32 to int8, achieving a 4x compression ratio with minimal accuracy loss.
When choosing a vector compression technique, it is essential to consider the trade-offs between compression ratio, speed, and accuracy impact. While PQ offers higher compression ratios, SQ provides faster and more accurate results. Understanding these differences is crucial for selecting the most suitable technique for a specific use case.
By considering these factors and selecting the appropriate technique, developers can optimize their vector compression and achieve better performance in their applications.

The myth that all vector databases perform similarly under load stems from a lack of comprehensive benchmarking and understanding of the underlying architectures. In reality, the performance of vector databases can vary significantly based on factors such as ingestion and query architecture.
When evaluating vector databases, it's essential to consider latency metrics, including p50, p95, and p99. These metrics provide insight into the distribution of query performance, which is critical for applications requiring low-latency responses.
A recent benchmark ailog.fr evaluated Qdrant, Milvus, Weaviate, and Pinecone at 10M vectors (1536 dimensions) and reported
The results show that Qdrant outperforms Milvus, Weaviate, and Pinecone in terms of latency, with p50, p95, and p99 latencies of 4.8ms, 12.3ms, and 18.1ms, respectively. Milvus, Weaviate, and Pinecone trail behind, with Pinecone exhibiting the highest latency.
When choosing a vector database, consider not only latency metrics but also memory usage. The benchmark reported the following memory usage per million vectors: Qdrant 1.42 GB, Milvus 1.87 GB, Weaviate 1.61 GB.
By understanding the performance differences between vector databases, developers can make informed decisions when selecting a suitable database for their use case.
The HNSW (Hierarchical Navigable Small World) algorithm is widely used for vector search due to its high recall and efficiency. However, it is not the best choice for every use case. HNSW's performance is highly dependent on its parameters, which can significantly affect memory usage, build time, and search quality.
HNSW's parameters, including M, efConstruction, and efSearch, play a key role in determining its performance. M controls graph connectivity, influencing memory, build work, and search quality. efConstruction controls build-time exploration, with larger values building a better graph at higher cost. efSearch controls query-time candidate breadth, increasing it improves recall while increasing latency.
Despite its strengths, HNSW may not always be the best choice. For instance, Google's ScaNN achieves roughly 2x query throughput at a given accuracy compared to other libraries, and demonstrates higher Recall@1 for a fixed latency budget versus HNSW or IVF-PQ implementations, ScaNN is particularly effective for inner-product search and uses anisotropic vector quantization to improve search efficiency while maintaining high accuracy.
When choosing a vector search algorithm, consider the specific requirements of your use case. If high recall is crucial and memory usage is not a concern, HNSW may be a suitable choice. However, if you need a balance between recall, latency, and memory usage, or if you're working with inner product searches, ScaNN or other algorithms may be more suitable. While HNSW is a powerful algorithm for vector search, it is not the best choice for every use case. Carefully evaluate your requirements and consider alternative algorithms like ScaNN to ensure the best performance for your specific use case.

Many believe that the underlying architecture of a vector database does not significantly impact performance, as long as the database supports basic operations like indexing and querying. However, this is far from the truth.
The architecture of a vector database plays a key role in determining its performance, scalability, and usability. One key architectural decision is whether to use separate nodes for ingestion and querying or to serve both purposes from the same nodes.
Milvus, a popular open-source vector database, adopts an architecture where ingestion and querying are handled by separate node types. This design reduces the interaction between ingestion and query loads, improving overall system performance and scalability Milvus Blog.
In contrast, Qdrant, another popular vector database, serves both ingestion and querying from the same nodes. While this approach can simplify the architecture, it may lead to performance bottlenecks and increased latency under heavy loads.
Another critical aspect of vector database architecture is the tuning of IVF (Inverted File) indexes. IVF is a technique used to accelerate similarity searches in high-dimensional spaces. The performance of IVF indexes is heavily influenced by parameters such as:
nlist: The number of clusters to group similar vectors into. A higher nlist value can improve search accuracy but increases indexing time.nprobe: The number of clusters to search during query time. Increasing nprobe improves recall but at the cost of higher latency.spherical centroids: Using spherical centroids can improve performance when the metric is cosine similarity.Optimally tuning these parameters is crucial to achieving the right balance between search performance, recall, and latency Kodesage Blog.
By understanding the impact of architecture choices and IVF tuning parameters, developers can design and deploy vector databases that meet their specific use case requirements and performance expectations.
No. HNSW can deliver high recall and supports incremental inserts without requiring a full index rebuild in many implementations, but its memory usage and build time are typically higher than IVFFlat. On a pgvector benchmark with 58k records, HNSW took ~30-81 seconds to build versus ~15 seconds for IVFFlat, though HNSW query latency was ~1.5ms compared to IVFFlat's ~2.4ms. Choose HNSW when query speed and recall matter most; choose IVFFlat when memory and build time are constrained.
PQ splits vectors into subspaces and quantizes each independently, enabling up to 64x compression, but its distance calculations are not SIMD-friendly and therefore slower than SQ. SQ compresses each float32 component to int8, achieving 4x compression with minimal accuracy loss—error under 1% in Qdrant experiments. Binary quantization reduces each component to one or two bits for up to 32x compression, but suffers a much steeper decay in recall metrics.
Yes, significantly. In a 10M vector benchmark with 1536 dimensions, Qdrant achieved p50 latency of 4.8ms while Pinecone lagged at 12.3ms, and memory per million vectors ranged from 1.42GB for Qdrant to 1.87GB for Milvus. Architecture choices also matter: Milvus separates ingestion and query nodes to reduce load interaction, whereas Qdrant serves both from the same nodes. These differences directly impact throughput, latency, and scalability under concurrent workloads.
For HNSW, M controls graph connectivity, efConstruction controls build-time exploration, and efSearch controls query-time candidate breadth—increasing efSearch improves recall but raises latency. For IVF, set nlist to at least 4√N (default 1000) and nprobe to 10 by default; increasing nprobe improves recall at the cost of higher latency. When using cosine similarity, for cosine-similarity workloads, spherical clustering can be useful because it accounts for the angular nature of the similarity metric.
Discover why treating LLM evaluations like unit tests creates false security in CI/CD pipelines. Learn regression-testing discipline and metric validation...
Understand how GraphQL resolvers fetch data, the N+1 problem's real impact, and how DataLoader with batching and caching solves it in production.
Learn to build production-grade autonomous AI agents from scratch. This 5-stage roadmap covers orchestration, reliability, and Python code for Indian...


