Advanced 15 Questions • ~4 hrs study

Vector Databases

Vector databases for AI applications — Pinecone, Weaviate, ChromaDB, FAISS, embedding storage, similarity search algorithms, and RAG integration.

1

What is a vector database and why is it needed for AI?

Short Answer

A vector database stores and indexes high-dimensional embedding vectors for fast similarity search. Essential for RAG, recommendation systems, image search, and any AI application needing semantic retrieval.

Key Concepts

  • Embeddings: Dense vector representations of text/images (768-1536 dims)
  • Similarity metrics: Cosine similarity, Euclidean distance, dot product
  • ANN algorithms: HNSW, IVF, Product Quantization
  • Use cases: RAG, semantic search, deduplication, recommendations

💡 Memory Trick: "Vector DB = Library where books are filed by meaning, not alphabetically"

2

Compare FAISS, Pinecone, Weaviate, and ChromaDB.

Short Answer

FAISS: Meta's library, local, fast but no persistence. Pinecone: Managed cloud service, easiest to use. Weaviate: Open-source, built-in vectorization. ChromaDB: Lightweight, great for prototyping.

DB Type Best For
FAISSLibrary (local)Research, large-scale offline
PineconeManaged SaaSProduction, no infra management
WeaviateOpen-sourceHybrid search, auto-vectorization
ChromaDBLightweightPrototyping, small projects

💡 Memory Trick: "FAISS = DIY power tool | Pinecone = hire a contractor | Chroma = quick prototype"

3

What is HNSW and how does it enable fast similarity search?

Short Answer

HNSW (Hierarchical Navigable Small World) is a graph-based ANN algorithm. It builds a multi-layer graph where upper layers have long-range connections (for coarse search) and lower layers have short-range connections (for fine-grained search). Query time: O(log n).

How It Works

  • Multiple layers: Top = few nodes with long jumps, Bottom = all nodes
  • Search starts at top layer, greedily moves to nearest neighbor
  • Drops to lower layer for finer search, repeats
  • Trade-off: Memory (stores graph) vs Speed (very fast queries)

💡 Memory Trick: "HNSW = Skip list for vectors. Zoom in from highway (coarse) to local streets (fine)"

Questions 4-15 continue with the same detailed format.

Topics covered: Embedding models (OpenAI, Sentence Transformers), Chunking strategies, Hybrid search (vector + keyword), Metadata filtering, Index tuning, Scaling vector databases, and integrating vector DBs with LangChain/LlamaIndex.

View Full Documentation →