A deep dive into how vector embeddings and similarity search power modern AI applications
Vector search is revolutionizing how we build answer engines and intelligent search systems. In this post, we'll explore the technology that powers SearchAF's answer generation capabilities.
Vector embeddings are numerical representations of data that capture semantic meaning. Instead of storing text as words, we convert it into high-dimensional vectors (arrays of numbers).
"running shoes" → [0.24, -0.18, 0.91, ... 0.33] // 768 dimensions
"athletic footwear" → [0.26, -0.17, 0.89, ... 0.31] // similar vector!
Notice how similar concepts have similar vectors, even though the words are different.
When you add a product to SearchAF, we:
When a user searches:
Find products with vectors closest to the query vector using:
Cosine Similarity
similarity = (A · B) / (||A|| × ||B||)
This measures the angle between vectors - closer angles mean more similar meaning.
Traditional databases struggle with vector operations:
SearchAF is built on Antfly, which provides:
SELECT * FROM products
WHERE vector_similarity(embedding, query_vector) > 0.7
AND price < 100
AND in_stock = true
ORDER BY vector_similarity(embedding, query_vector) DESC
LIMIT 10
Different models excel at different tasks:
Pure vector search isn't always optimal. SearchAF uses hybrid search:
final_score = α × vector_score + (1-α) × keyword_score
Where α controls the balance:
α = 0: Pure keyword (traditional BM25)α = 0.5: Equal weightα = 1: Pure semanticThis catches:
Our benchmarks show:
| Metric | Traditional Search | Vector Search | Hybrid |
|---|---|---|---|
| Relevance (NDCG) | 0.72 | 0.84 | 0.91 |
| Latency (p95) | 12ms | 45ms | 28ms |
| Zero Results | 18% | 4% | 2% |
Problem: New products lack interaction data Solution: Vector embeddings work immediately from product descriptions
Problem: Vector operations are compute-intensive Solution: Antfly's distributed architecture and HNSW indexes
Problem: Models can become outdated Solution: Automated reindexing and A/B testing of new models
Want to leverage vector search in your application?
We're excited about upcoming developments:
Want to learn more? Check out our Semantic Search Guide