
vector-index-tuning
โ 37,559by wshobson ยท part of wshobson/agents
Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.
This is the playbook your agent receives when the skill activates โ you don't need to read it to use the skill, but it's here to audit before installing.
Vector Index Tuning
Guide to optimizing vector indexes for production performance.
When to Use This Skill
- Tuning HNSW parameters
- Implementing quantization
- Optimizing memory usage
- Reducing search latency
- Balancing recall vs speed
- Scaling to billions of vectors
Core Concepts
1. Index Type Selection
Data Size Recommended Index
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
< 10K vectors โ Flat (exact search)
10K - 1M โ HNSW
1M - 100M โ HNSW + Quantization
> 100M โ IVF + PQ or DiskANN2. HNSW Parameters
| Parameter | Default | Effect |
|---|---|---|
| M | 16 | Connections per node, โ = better recall, more memory |
| efConstruction | 100 | Build quality, โ = better index, slower build |
| efSearch | 50 | Search quality, โ = better recall, slower search |
3. Quantization Types
Full Precision (FP32): 4 bytes ร dimensions
Half Precision (FP16): 2 bytes ร dimensions
INT8 Scalar: 1 byte ร dimensions
Product Quantization: ~32-64 bytes total
Binary: dimensions/8 bytesTemplates and detailed worked examples
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Best Practices
Do's
- Benchmark with real queries - Synthetic may not represent production
- Monitor recall continuously - Can degrade with data drift
- Start with defaults - Tune only when needed
- Use quantization - Significant memory savings
- Consider tiered storage - Hot/cold data separation
Don'ts
- Don't over-optimize early - Profile first
- Don't ignore build time - Index updates have cost
- Don't forget reindexing - Plan for maintenance
- Don't skip warming - Cold indexes are slow
npx skills add https://github.com/wshobson/agents --skill vector-index-tuningRun this in your project โ your agent picks the skill up automatically.
No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
Licensed under MITโ you can use, modify, and redistribute it under that license's terms.
View the full license file on GitHub โ