v2.0.0
[2.0.0] - 2025-12-23
Breaking Changes
-
Backend Migration: sqlite-vec → usearch HNSW
- Vector search now uses usearch's high-performance HNSW algorithm
- 10-100x faster similarity search for large collections
- Vector data stored in separate
.usearchfiles per collection (e.g.,mydb.db.default.usearch) - SQLite still stores metadata, text, and FTS5 index
-
Removed
DistanceStrategy.L1- Manhattan distance not supported by usearch -
Storage Format Change
- Embeddings now stored in both usearch index AND SQLite (for MMR support)
- Existing sqlite-vec databases will auto-migrate on first open
- Migration is one-way; backup before upgrading
Added
-
usearch_index.py- New UsearchIndex wrapper class:- Thread-safe HNSW index operations (lock on writes, lock-free reads)
- Automatic persistence to
.usearchfiles - Upsert support (removes existing keys before add)
- BIT quantization using Hamming metric with bit packing
- Configurable HNSW parameters (connectivity, expansion_add, expansion_search)
-
Proper MMR Implementation - Max Marginal Relevance now computes actual pairwise similarity between candidates and selected documents using stored embeddings
-
Embedding Storage in SQLite - Embeddings stored as BLOB for:
- Accurate MMR diversity computation
- Future index rebuild from SQLite backup
- Schema auto-migrates existing tables
-
VectorCollection.rebuild_index()- Reconstruct usearch HNSW index from SQLite embeddings:- Useful for index corruption recovery
- Tune HNSW parameters (connectivity, expansion_add, expansion_search)
- Reclaim space after many deletions
-
VectorDB.check_migration(path)- Dry-run migration check:- Reports which collections need migration
- Shows total vector count and estimated storage
- Provides detailed rollback instructions
-
Adaptive Search - Automatically optimizes search strategy based on collection size:
- Collections < 10k vectors use brute-force (
exact=True) for perfect recall - Collections ≥ 10k vectors use HNSW for faster approximate search
- Threshold configurable via
constants.USEARCH_BRUTEFORCE_THRESHOLD
- Collections < 10k vectors use brute-force (
-
exactparameter - Force search mode insimilarity_search():None(default): adaptive based on collection sizeTrue: force brute-force for perfect recallFalse: force HNSW approximate search
-
Quantization.FLOAT16- Half-precision floating point:- 2x memory savings compared to FLOAT32
- 1.5x faster search with minimal precision loss
- Ideal for embeddings where full precision isn't needed
-
threadsparameter - Parallel execution control:- Added to
add_texts()andsimilarity_search() 0(default): auto-detect optimal thread count- Explicit value: control parallelism for batch operations
- Added to
-
Auto Memory-Mapping - Large indexes automatically use memory-mapped mode:
- Indexes >100k vectors use
view=Truefor instant startup - Lower memory footprint for large collections
- Transparent upgrade to writable mode on add operations
- Configurable via
constants.USEARCH_MMAP_THRESHOLD
- Indexes >100k vectors use
-
similarity_search_batch()- Multi-query batch search:- ~10x throughput for batch query workloads
- Uses usearch's native batch search under the hood
- Same parameters as
similarity_search()but accepts list of queries
-
examples/backend_benchmark.py- Benchmark script comparing usearch vs brute-force:- Measures speedup, recall, and storage efficiency
- Supports all quantization levels
- Validates 10-100x performance claims
Changed
- Dependencies: Replaced
sqlite-vec>=0.1.6withusearch>=2.12 - CatalogManager: Removed vec0 virtual table operations, added embedding column
- SearchEngine: Rewrote to use UsearchIndex for all vector operations
- VectorCollection: Creates usearch index at
{db_path}.{collection}.usearch
Migration Notes
- Backup your database before upgrading
- On first open, existing sqlite-vec data will be migrated automatically
- New
.usearchfiles will be created alongside your.dbfile - The legacy sqlite-vec table is dropped after successful migration