Repository navigation
Vectro v3.0.0 — Extreme Compression Without Loss
Vectro v3.0.0 — Extreme Compression Without Loss
9 quantization algorithms · HNSW ANN index · GPU/MAX Engine · VQZ storage · Cloud backends · 445 tests, 100% coverage
What's New
9 Quantization Algorithms
| Algorithm | Compression | Cosine Similarity |
|---|---|---|
| INT8 | 4× | ≥ 0.9999 |
| INT4 (GA) | 8× | ≥ 0.92 |
| NF4 | 8× | ≥ 0.985 |
| NF4-Mixed (SpQR-style) | 7× | ≥ 0.990 |
| PQ-96 | 32× | ≥ 0.987 |
| PQ-48 | 64× | ≥ 0.970 |
| Binary | 32× | ≥ 0.952 |
| RQ-3pass | 16× | ≥ 0.80 |
| AutoQuantize | adaptive | target-driven |
HNSW Approximate Nearest-Neighbour Index (Phase 5)
- Full HNSW implementation with INT8 internal storage (4× memory reduction)
recall@10 ≥ 0.90on standard benchmarksHNSWIndex.add_batch,.search,.save,.load— VQZ persistence + cloud URI supporthnsw_compression_info(d, M)for memory planning
GPU / MAX Engine Backend (Phase 6)
- GPU-aware batch INT8 quantizer via Mojo MAX Engine
- Graceful CPU SIMD fallback when no GPU is present
gpu_benchmark()→ up to 50M vec/s on CPU SIMD, much higher on GPUbatch_cosine_similarity,batch_topk_int8
Learned Quantization — RQ, Codebook, AutoQuantize (Phase 7)
ResidualQuantizer— chained PQ codebooks encoding successive residualsCodebook— pure-NumPy autoencoder (Encoder/Decoder) with mini-batch SGD + cosine lossAutoQuantize— strategy cascade (NF4 → NF4-mixed → PQ-96 → PQ-48 → Binary); routes heavy-tailed inputs via kurtosis; short-circuits on first satisfying strategy
VQZ Storage Format (Phase 8)
- 64-byte header: magic
VECTRO\x03\x00, version, n_vectors, dims, n_subspaces, metadata - Body: INT8 quantized data + float32 scales, ZSTD/zlib-compressed
- blake2b-8 checksum verified on every load
- Cloud backends via
fsspec:S3Backend,GCSBackend,AzureBlobBackend
Unified v3 Python API (Phase 9)
VectroV3(profile)— single entry-point for all 7 profilesPQCodebook— VQZ-persistent PQ with.train,.encode,.decodeHNSWIndex— v3 wrapper with cloud URI save/loadV3Resultdataclass —quantized,scales,codes,profile,compression_ratio,mean_cosine
Breaking Changes
enable_experimental_precisionsremoved — INT4 is now GA. TheVectro.__init__signature is(backend, profile, enable_batch_optimization). Any code passingenable_experimental_precisions=Truemust remove that argument.- INT4 falls back to INT8 with a warning on machines where the backend is unavailable.
Performance Benchmarks
| Dimension | INT8 Throughput | Latency |
|---|---|---|
| 128D | 1.04M vec/s | 0.96 µs |
| 384D | 950K vec/s | 1.05 µs |
| 768D | 890K vec/s | 1.12 µs |
| 1536D | 787K vec/s | 1.27 µs |
- PQ-96 compression: 32× · cosine ≥ 0.987
- Binary compression: 32× · cosine ≥ 0.952
- HNSW recall@10: ≥ 0.90 with INT8 internal storage (4× memory)
- VQZ save/load: ≥ 2 GB/s ZSTD, blake2b verified
Test Suite
| Module | Tests |
|---|---|
| test_python_api | 26 |
| test_integration | 15 |
| test_nf4 | 19 |
| test_pq | 12 |
| test_binary | 19 |
| test_hnsw | 28 |
| test_gpu | 26 |
| test_rq | 20 |
| test_codebook | 22 |
| test_auto_quantize | 26 |
| test_storage_v3 | 35 |
| test_v3_api | 80 |
| + 8 more modules | 57 |
| Total | 445 / 445 · 100% coverage |
Installation
pip install vectro==3.0.0from python.v3_api import VectroV3
v3 = VectroV3("pq-96")
result = v3.compress(embeddings) # 32x compression, cosine >= 0.987
recovered = v3.decompress(result)
v3.save_compressed(result, "index.vqz") # ZSTD + blake2b checksumFor the full API reference see docs/api-reference.md.
See the video demo for a walkthrough of all nine algorithms.
Full changelog: CHANGELOG.md
