Back to Theory
Architecture6 min read · June 16, 2026

How Feather DB Uses SIMD to Hit Sub-Millisecond ANN Latency on x86

Feather DB Phase 8 adds runtime-dispatched SSE/AVX L2 kernels on x86. The result: faster distance computation at the HNSW candidate evaluation step. Here's the architecture and what it means for your workload.

F
Feather DB
Engineering

The distance computation bottleneck in ANN

HNSW-based approximate nearest neighbor search is fundamentally a graph traversal problem. Starting from a set of entry points, you follow edges to candidate nodes, compute distances to the query, and keep a priority queue of the best k candidates. The traversal itself is graph-topology-bound — you can't skip nodes without hurting recall. But the distance computation is embarrassingly parallelizable: you have a query vector and a candidate vector, and you want L2 (or cosine) distance as fast as possible.

At 768 dimensions (Feather's native format for Gemini embeddings), an L2 distance computation requires 768 subtraction operations, 768 multiply-accumulates, and a sqrt. Doing this in scalar code on a modern CPU takes ~200–400ns per pair. At ef=50 and M=16, an HNSW search at 500K vectors evaluates several thousand candidate pairs — which adds up.

What SIMD changes

SSE processes 4 float32 values in parallel. AVX processes 8. AVX-512 processes 16. A 768-dim L2 computation in AVX: 96 AVX operations instead of 768 scalar ones, plus the hadd reduction. At typical AVX throughput, this cuts the per-pair L2 computation from ~300ns to ~60ns — a 5× improvement on the compute step.

The overall ANN latency improvement is lower than 5× because HNSW search has other costs (graph traversal, priority queue operations, memory access patterns). In Feather's benchmarks, the SIMD update contributes ~1.4–1.8× improvement in p50 search latency on x86 hardware.

Runtime dispatch

Feather DB's SIMD implementation is runtime-dispatched. At startup, Feather reads CPUID to detect which instruction sets are available, then selects the best L2 kernel:

  • AVX-512 available → use AVX-512 L2 kernel (16 floats/op)
  • AVX2 available → use AVX2 L2 kernel (8 floats/op)
  • SSE4.2 available → use SSE L2 kernel (4 floats/op)
  • None available (arm64, older x86) → scalar fallback

arm64 (Apple Silicon, ARM servers) uses -O3 + NEON auto-vectorization via the compiler. Feather doesn't ship hand-coded ARM NEON kernels — the compiler does a good job on modern arm64 with -O3 -ffast-math.

Current benchmark numbers

On SIFT1M (500K × 128-dim), measured on an x86 machine with AVX2:

MetricValue
p50 latency (ef=50)0.19 ms
p99 latency (ef=50)0.13 ms
Recall@1097.2%

Note: p99 < p50 is not a typo — SIFT1M has variable cluster density. Some queries find their nearest neighbors quickly (low ef depth), others traverse deeper. p50 samples into a slow cluster; p99 happens to hit a fast one in this dataset.

How SIMD interacts with int8 quantization

With in-RAM int8 quantization (v0.15.0), vectors are stored as int8 bytes with a per-vector scale factor. The current SIMD kernels operate on float32 — so int8 vectors are dequantized before the L2 computation. This means the SIMD speedup still applies, but you also get the cache locality benefit of int8 storage (more vectors fit in L1/L2 cache), which independently reduces memory latency.

Future work: int8 SIMD kernels that compute L2 directly in int8 arithmetic would compound both benefits. This is tracked in the Feather roadmap.

What this means for your deployment

If you're running Feather on x86 (AWS EC2, GCP, Azure, most on-prem hardware), the SIMD kernels activate automatically — you don't need to change any code or configuration. Just upgrade:

pip install --upgrade feather-db

On arm64 (Apple Silicon, Graviton), the improvement comes from compiler-vectorized NEON, which Feather has optimized for since v0.10. No change needed there either.

The sub-millisecond ANN latency (p50 = 0.19ms at 500K vectors) is achievable today on any modern server — x86 or arm64 — without dedicated hardware. This is the number that makes embedded, in-process vector search viable as a replacement for hosted vector database services.

GitHub: github.com/feather-store/feather