Vector Search in Liven: No Separate Database Required
How Liven implements native vector similarity search with int8 quantized embeddings and cosine similarity — no external index or separate database needed.
The Problem with Vector Search Today
Semantic search and RAG (Retrieval-Augmented Generation) have become essential for modern applications. But adding vector search to a database typically means:
- Running a separate vector database (Pinecone, Qdrant, Milvus)
- Maintaining synchronization between your primary database and the vector index
- Managing two infrastructure stacks
Liven eliminates this complexity by embedding vector search directly into the storage engine.
How It Works
Liven stores vectors as a first-class data type (DataValue::Vector) alongside the rest of your data. This means:
- Vectors live in the same stream as your other records
- Vector search is just another pipeline stage
- No external index, no synchronization, no extra infrastructure
Int8 Quantization
Liven uses int8 quantized vectors rather than full float32. This gives you:
- 4× smaller storage compared to float32
- Faster scan due to reduced memory bandwidth
- Minimal accuracy loss for most use cases
Using Vector Search
Insert documents with embeddings:
db.insert("documents", "doc1", json!({"title": "Machine Learning Fundamentals","embedding": [1, 0, 0, 0, 1] // int8 quantized}))?;
Search for similar documents:
let query = vec![1i8, 0, 0, 0, 1];let results = db.run(Pipeline::from("documents").vector_filter("embedding", query, 0.75).limit(5))?;
The vector_filter stage:
- Computes cosine similarity between the query vector and each stored vector
- Filters results below the threshold
- Returns records sorted by similarity score
Performance
In our benchmarks, vector search over 100K vectors completes in under 50ms on a single core — competitive with dedicated vector databases for workloads under 10M vectors where Liven's simplicity advantage is most valuable.
| Vectors | Query Time (p50) | Recall@10 |
|---|---|---|
| 10K | 4ms | 99.2% |
| 100K | 45ms | 98.7% |
| 1M | 480ms | 97.1% |
When to Use Liven for Vector Search
Liven's vector search is ideal for:
- Edge and IoT devices — single binary, no external dependencies
- Small to medium vector collections (under 10M vectors)
- Applications that already use Liven — no extra infrastructure
- Real-time streaming where vectors arrive with other data
For large-scale vector search with hundreds of millions of vectors, a dedicated vector database may still be the right choice. But for the vast majority of applications, Liven's integrated approach eliminates complexity without sacrificing performance.