vector-index-tuning
它能做什么
这个工具可以让图片或文本等海量数据的搜索更快、更高效。它会调整数据的组织方式,让 AI 能更准确、更快速地找到你要的内容,同时占用更少内存。
适用场景
- ✓当你的数据量很大、搜索速度很慢时。
- ✓当你需要在搜索速度和结果准确度之间取得平衡时。
- ✓当你需要降低数据搜索所占用的内存时。
技能链接
https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/vector-index-tuning/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“怎样优化相似图片搜索,让它更快、占用更少内存?”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会调整控制数据连接和存储方式的内部参数。它可以根据数据量以及你对速度和准确度的要求,选择不同的组织方法(如 HNSW 或量化)。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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 DiskANN
2. 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 bytes
Templates 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
常见问题
什么是“HNSW 参数”?
这些是影响 HNSW 这种数据组织方法下搜索速度和准确度的设置。调整它们可以改善结果。
什么是“量化”(quantization)?
这是一种减少数据在内存中占用空间的技术,能让搜索更快、成本更低,但可能会略微降低准确度。
“召回率与速度”是什么意思?
这是一个常见的权衡:提高搜索速度可能会降低结果的准确率(召回率),反之亦然。调优的目标是找到最适合你需求的平衡点。
详情
作者的原始描述
Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.
repo: wshobson/agents
热度
- GitHub 星标
- 41k
- 排名
- #6727
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …