Asked in a Senior AI engineer interview.
What they are really testing: whether you can reason about vector index architecture, memory and latency budgets, and the operational cost of keeping retrieval fast and fresh as the corpus grows, rather than just naming a vector database.
A strong answer:
- Start with the budget: at 1536-dimensional float32, one vector is about 6 KB raw, so a billion vectors is roughly 6 TB before index overhead. That forces compression and sharding decisions early.
- Use approximate nearest neighbor indexes such as HNSW for low-latency, high-recall workloads, and IVF-style partitioned indexes when memory is the binding constraint. Tune ef_search or nprobe against a measured recall target, not a default.
- Reduce footprint with product quantization or scalar quantization, and consider lower-dimensional embeddings or Matryoshka-style truncation where quality allows. Measure the recall loss on your own eval set.
- Shard by a stable key such as tenant or document collection, and fan out queries with a top-k merge. Keep metadata filters pushed down into the index so permission and tenant filters do not force post-filtering that drops results.
- Separate the write path from the read path: batch or streaming ingestion, versioned index builds, and blue-green swaps so re-embedding after a model change does not take the system offline.
- Add a reranker over a modest candidate set (for example top 50 to 100) so the expensive model only sees what the ANN stage returns, and monitor recall, p95 latency and index freshness as operational metrics.
Common mistakes:
- Recommending a vector database by name without discussing memory per vector, index type, or recall-versus-latency trade-offs.
- Ignoring filtering and permissions: post-filtering after a top-k search can return far fewer usable results than expected.
- Treating the index as static, with no plan for re-embedding, incremental updates, or zero-downtime rebuilds.
How would you structure the sharding and index choice for a corpus that grows by ten times in a year? Share your approach below.
Originally shared on LinkedIn.
An AI interview question every day, leadership for tech people and hands-on AI learning:
Top comments (0)