Vector DBs & RAG (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What are the key differences between Dense Vectors and Sparse Vectors?
junior LevelMost AskedCode Examplevector-databasesBasic
In Simple Words:
- Dense Vectors: Every dimension has a non-zero floating-point weight. Captures deep conceptual, contextual, and semantic meaning (e.g. OpenAI embeddings with 1536 dimensions).
- Sparse Vectors: Most dimensions are zero; only specific keyword token positions hold values (e.g. BM25, SPLADE). Excels at exact keyword matches, SKU lookups, part numbers, and proper nouns.
text
Dense vs Sparse Vector:
Dense (Semantic): [0.024, -0.198, 0.441, 0.009, -0.312, ...] (Length: 1536)
Sparse (Lexical): { token_382: 1.45, token_9201: 3.12 } (Length: 30000+, mostly 0)