repobenchmarks // vector database architecture
AI INFRASTRUCTURE
$ docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant

Qdrant Vector Database Engine

An engineering deep dive into Qdrant, the production-grade vector similarity search engine written in Rust with filtered HNSW indexing.

Index: HNSW Graphs Filtering: Pre-filtered Payload Protocols: gRPC & REST
Specs Snapshot
GitHub Stars: > 21k
Core Language: Rust
License: Apache 2.0

In modern AI applications, embeddings generated from large language models must be stored and queried with nearest-neighbor search. While general databases have added basic vector extensions, dedicated vector databases are required when scaling to millions of high-dimensional vectors with sub-10ms response constraints. Qdrant is an open-source vector similarity search engine engineered in Rust that excels at combined vector distance queries with strict payload attribute filtering.

Why Qdrant Filtering is Architecturally Superior

In most vector retrieval implementations, applying filters (e.g. user_id == 42 AND category == 'finance') follows one of two flawed approaches:

  • Post-Filtering: The engine performs a standard approximate nearest neighbor (ANN) search on the top 100 vectors, then filters out records that don't match the metadata. If only 2% of the vectors match the filter, the query returns almost zero results.
  • Pre-Filtering with Brute Force: The engine filters metadata first, then scans the matching vectors without an index, resulting in slow linear scans.
  • Qdrant's Filterable HNSW: Qdrant links its HNSW graph traversal directly with inverted payload indices. During the graph walk, Qdrant skips graph nodes that do not satisfy metadata constraints while maintaining graph connectivity, guaranteeing exact filtered results at full HNSW traversal speeds.
Qdrant Filterable HNSW Graph Navigation
Filterable HNSW Graph Architecture Shows Qdrant navigating HNSW graph layers while evaluating payload metadata filters inline. Layer 2 (Coarse Skip) Layer 1 (Medium) Layer 0 (All Vectors + Payload Filter) Inline Match: Evaluated during walk

Python Code Example: Filtered Vector Search

from qdrant_client import QdrantClient
from qdrant_client.models import Filter, FieldCondition, MatchValue

client = QdrantClient("localhost", port=6333)

# Search top 5 nearest neighbors filtered by tenant and status
results = client.query_points(
    collection_name="documents",
    query=[0.05, 0.61, -0.12, ...],
    query_filter=Filter(
        must=[
            FieldCondition(key="tenant_id", match=MatchValue(value="tenant_abc")),
            FieldCondition(key="status", match=MatchValue(value="published"))
        ]
    ),
    limit=5
)
Capability Qdrant Chroma DB
Core Language Compiled Rust (High Concurrency) Python / C++ bindings (Migrating to Rust)
Payload Filtering Native Filterable HNSW graph walks Basic SQLite metadata joins
Quantization Support Scalar (int8) & Binary quantization Limited compression options
High-Throughput Interface Native binary gRPC (Port 6334) + REST HTTP REST only
Clustering / Sharding Built-in Raft-based distributed cluster Single-instance focus
⚠ Memory Sizing: Vector Dimensions & HNSW Overhead

High-dimensional vectors (e.g. 1536 float32 numbers for OpenAI embeddings) consume approximately 6 KB per vector in memory plus 15–20% overhead for HNSW graph links. Storing 1 million vectors requires at least 7–8 GB of RAM. To dramatically reduce RAM costs, enable Qdrant's Scalar Quantization (converting 32-bit floats to 8-bit integers), which reduces memory footprint by up to 75% with negligible recall degradation.

Conclusion

Qdrant is currently the standout choice for self-hosted vector search in production AI systems. Its Rust-backed performance, native filterable HNSW graphs, and efficient scalar quantization make it reliable, cost-effective, and fast.