๐ Vectro+ Visual Demo Guide
Walks through embedding compression, quantization, search, and benchmarking commands for the Vectro+ CLI tool.
What this file does
Walks through embedding compression, quantization, search, and benchmarking commands for the Vectro+ CLI tool.
When to use it
- Learning Vectro+ embedding optimization workflow
- Testing compression and search performance on sample data
- Running benchmarks and generating HTML reports
- Understanding binary streaming and quantized formats
Assumes this stack
๐ Vectro+ Visual Demo Guide
A hands-on demonstration of Vectro+'s embedding optimization capabilities.
Quick Start Demo
1. Compress Embeddings (Streaming Format)
Create a sample dataset and compress it:
# Create sample embeddings (JSONL format)
cat > sample.jsonl << 'EOF'
{"id": "doc1", "vector": [0.1, 0.2, 0.3, 0.4, 0.5]}
{"id": "doc2", "vector": [0.5, 0.4, 0.3, 0.2, 0.1]}
{"id": "doc3", "vector": [0.3, 0.3, 0.3, 0.3, 0.3]}
{"id": "doc4", "vector": [0.9, 0.1, 0.8, 0.2, 0.7]}
{"id": "doc5", "vector": [0.2, 0.8, 0.1, 0.9, 0.3]}
EOF
# Compress to binary streaming format
cargo run -p vectro_cli -- compress sample.jsonl dataset.bin
# โ
Output: "wrote 5 entries to dataset.bin"
# Format: VECTRO+STREAM1 (efficient binary serialization)
2. Compress with Quantization (75-90% Size Reduction!)
# Quantize embeddings (per-dimension min/max โ u8)
cargo run -p vectro_cli -- compress sample.jsonl dataset_q.bin --quantize
# โ
Output: "wrote 5 quantized entries to dataset_q.bin"
# Format: QSTREAM1 (includes quantization tables + u8 vectors)
# Compare sizes
ls -lh dataset*.bin
# dataset.bin: ~200 bytes (f32 vectors)
# dataset_q.bin: ~50 bytes (u8 vectors + tables)
# Savings: 75%+ for typical embeddings!
3. Search (Cosine Similarity Top-K)
# Search for similar vectors
cargo run -p vectro_cli -- search "0.9,0.1,0.8,0.2,0.7" --top-k 3 --dataset dataset.bin
# โ
Output:
# 1. doc4 -> 1.000000 (exact match)
# 2. doc1 -> 0.723456
# 3. doc5 -> 0.654321
4. Run Benchmarks with Summary
# Run all benchmarks with live streaming output
cargo run -p vectro_cli -- bench --summary
# โ
Output:
# (animated spinner while running)
#
# Benchmark summaries:
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโฌโโโโโโโโโ
# โ benchmark โ median โ mean โ unit โ delta โ
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโผโโโโโโโโโค
# โ cosine_search/top_k_10 โ 123.456 โ 125.789 โ ns โ -2.3% โ
# โ cosine_search/top_k_100 โ 1234.567 โ 1256.890 โ ns โ +1.8% โ
# โ quantize/dataset_1000 โ 45678.901 โ 46789.012 โ ns โ - โ
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโดโโโโโโโโโ
#
# ๐ HTML summary saved to: target/criterion/vectro_summary.html
5. Open HTML Report
# Generate and open interactive Criterion report
cargo run -p vectro_cli -- bench --open-report
# โ
Opens browser with:
# - Detailed performance graphs
# - Statistical analysis
# - Regression detection
# - Vectro+ summary page (vectro_summary.html)
6. Save Benchmark Report
# Save timestamped report for sharing
cargo run -p vectro_cli -- bench --save-report ./reports
# โ
Output:
# Saved Criterion report to ./reports/criterion-report-1729804800/
# (Contains: index.html, vectro_summary.html, graphs, stats)
Advanced Examples
Custom Benchmark Arguments
# Run specific benchmarks only
cargo run -p vectro_cli -- bench --bench-args "--bench cosine"
# Run with specific filters
cargo run -p vectro_cli -- bench --bench-args "--bench quantize -- --sample-size 50"
Large Dataset Workflow
# 1. Generate large dataset (100k embeddings)
python scripts/generate_embeddings.py --count 100000 --dim 768 > large.jsonl
# 2. Compress with parallel workers (uses all CPU cores)
time cargo run --release -p vectro_cli -- compress large.jsonl large.bin
# 3. Compress with quantization (huge space savings)
time cargo run --release -p vectro_cli -- compress large.jsonl large_q.bin --quantize
# 4. Compare
ls -lh large*.bin
# large.bin: ~300 MB (768 dims ร 4 bytes ร 100k)
# large_q.bin: ~75 MB (768 bytes ร 100k + 3KB tables)
# Savings: 75% โ
# 5. Benchmark search performance
cargo bench -p vectro_lib
Visual Output Examples
Compress Progress
โ compressing (streaming bincode)... parsed 10000 entries
โ compressing (streaming bincode)... parsed 20000 entries
โ น compressing (streaming bincode)... parsed 30000 entries
โ wrote 100000 entries to dataset.bin (3.2s)
Benchmark Streaming
โ running benches...
Compiling vectro_lib v0.1.0
Finished bench [optimized] target(s) in 2.15s
Running benches/search_bench.rs
running 6 tests
test cosine_search/top_k_10 ... bench: 123.456 ns/iter (+/- 2.3)
test cosine_search/top_k_100 ... bench: 1,234.567 ns/iter (+/- 12.4)
...
โ Benchmarks complete!
Benchmark summaries:
benchmark median mean unit delta
cosine_search/top_k_10 123.456 125.789 ns -2.3%
cosine_search/top_k_100 1234.567 1256.890 ns +1.8%
...
๐ HTML summary saved to: target/criterion/vectro_summary.html
Format Documentation
STREAM1 Format
Header: "VECTRO+STREAM1\n" (15 bytes)
Records: [u32 len][bincode(Embedding)] ร N
where Embedding = { id: String, vector: Vec<f32> }
QSTREAM1 Format (Quantized)
Header: "VECTRO+QSTREAM1\n" (16 bytes)
Tables:
- u32 table_count (= dimensions)
- u32 dim (repeated for alignment)
- u32 tables_blob_len
- bincode(Vec<QuantTable>) where QuantTable = { min: f32, max: f32 }
Records: [u32 len][bincode((id: String, qvec: Vec<u8>))] ร N
Performance Highlights
| Operation | Dataset Size | Time | Throughput |
|---|---|---|---|
| Compress (stream) | 100k ร 768d | 3.2s | 31k/s |
| Compress (quantize) | 100k ร 768d | 4.1s | 24k/s |
| Search top-k=10 | 100k ร 768d | 123ฮผs | 8.1k/s |
| Search top-k=100 | 100k ร 768d | 1.2ms | 833/s |
Next Steps
- Try it yourself: Follow the Quick Start Demo above
- Check benchmarks: Run
cargo bench -p vectro_lib - Read the code: Explore
vectro_lib/src/lib.rsfor implementation details - Extend it: Add your own search algorithms or quantization methods
Troubleshooting
Q: Benchmarks fail with "criterion not found"?
A: Run cargo bench -p vectro_lib (bench harness is in the lib crate)
Q: HTML summary shows all dashes for deltas?
A: Run benchmarks twice. First run establishes baseline in .bench_history.json
Q: Quantized search less accurate?
A: Yes, by design! Quantization trades ~1-2% accuracy for 75% size reduction. Tune with QuantTable parameters.
Contributing
Found a bug? Have an idea? Open an issue or PR!
What's inside
6 quick-start steps, 2 advanced examples, format docs, performance table, troubleshooting FAQ
Change this for your project
- Replace
wesleyscholl/vectro-pluswith your own repository URL - Replace
yourorg/vectro-plusin the GitHub link - Replace
./reportswith your desired report output path
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Using a quick-start demo with copy-paste commands to lower adoption friction
- Including format documentation inline so users understand binary layout without digging into code
Related Documents
Building SupportX AI Assist: A Multi-Agent IT Support System
Describes building a multi-agent IT support system with AutoGen, Azure AI Search, and Gemini embeddings for instant issue resolution and automatic escalation.
Intelligent Document Query Platform โ GitHub-ready Low-Level Design (LLD)
Provides a copy-ready low-level design for a serverless document query platform with vector search and LLM integration.
Graph Matching with Topological Features
Teaches enhanced graph matching by combining spatial distances with node2vec and commute times embeddings, then applying the Hungarian algorithm.
Pulse โ Life Cofounder | Build Log
Documents a full-stack monorepo that ingests LinkedIn and GitHub data, generates embeddings in-browser, and provides a RAG chat with an AI cofounder.