Optimize vector index performance for latency, recall

Vector index tuning

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Vector index tuning cover

Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.

---
name: vector-index-tuning
description: Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.
---

# 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

Overview

Guide to optimizing vector indexes for production performance.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill vector-index-tuning -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/llm-application-dev/skills/vector-index-tuning
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/bde3a85d27303ac2c78c/vector-index-tuning.zip" -OutFile "$env:TEMP\vector-index-tuning.zip"; Expand-Archive "$env:TEMP\vector-index-tuning.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md2.3 KB
  • references/1 file · 12.9 KB
Read the files here
wshobson/4236bb92 files
SKILL.md
Show the full text70 lines

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
1---
2name: vector-index-tuning
3description: Optimize vector index performance for latency, recall, and memory. Use when tuning HNSW parameters, selecting quantization strategies, or scaling vector search infrastructure.
4---
5 
6# Vector Index Tuning
7 
8Guide to optimizing vector indexes for production performance.
9 
10## When to Use This Skill
11 
12- Tuning HNSW parameters
13- Implementing quantization
14- Optimizing memory usage
15- Reducing search latency
16- Balancing recall vs speed
17- Scaling to billions of vectors
18 
19## Core Concepts
20 
21### 1. Index Type Selection
22 
23```
24Data Size Recommended Index
25────────────────────────────────────────
26< 10K vectors → Flat (exact search)
2710K - 1M → HNSW
281M - 100M → HNSW + Quantization
29> 100M → IVF + PQ or DiskANN
30```
31 
32### 2. HNSW Parameters
33 
34| Parameter | Default | Effect |
35| ------------------ | ------- | ---------------------------------------------------- |
36| **M** | 16 | Connections per node, ↑ = better recall, more memory |
37| **efConstruction** | 100 | Build quality, ↑ = better index, slower build |
38| **efSearch** | 50 | Search quality, ↑ = better recall, slower search |
39 
40### 3. Quantization Types
41 
42```
43Full Precision (FP32): 4 bytes × dimensions
44Half Precision (FP16): 2 bytes × dimensions
45INT8 Scalar: 1 byte × dimensions
46Product Quantization: ~32-64 bytes total
47Binary: dimensions/8 bytes
48```
49 
50## Templates and detailed worked examples
51 
52Full template library and detailed worked examples live in `references/details.md`. Read that file when you need the concrete templates.
53 
54## Best Practices
55 
56### Do's
57 
58- **Benchmark with real queries** - Synthetic may not represent production
59- **Monitor recall continuously** - Can degrade with data drift
60- **Start with defaults** - Tune only when needed
61- **Use quantization** - Significant memory savings
62- **Consider tiered storage** - Hot/cold data separation
63 
64### Don'ts
65 
66- **Don't over-optimize early** - Profile first
67- **Don't ignore build time** - Index updates have cost
68- **Don't forget reindexing** - Plan for maintenance
69- **Don't skip warming** - Cold indexes are slow
70 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
MCPPostgres server with health checksPostgres MCP Procrystaldba/postgres-mcp · by crystaldbaPostgres server with health checks, index tuning and explain plans, with a restricted read-only mode for production.★ 3.3k GitHub starsSkillPostgres best practices maintained by SupabaseSupabase postgres best practicessupabase/agent-skills · by supabasePostgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.★ 2.7k GitHub starsSkillDesigns database schemas, indexing strategiesDatabase designCloudAI-X/claude-workflow-v2 · by CloudAI-XDesigns database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.★ 1.4k GitHub starsSkillExecute database migrations across ORMsDatabase migrationwshobson/agents · by wshobsonExecute database migrations across ORMs and platforms with zero-downtime strategies, data transformation, and rollback procedures. Use when migrating databases, changing schemas, performing data transformations, or implementing zero-downtime deployment strategies.★ 39.9k GitHub starsSkillDesign database schemas, plan data migrationsDatabase Designer - POWERFUL Tier Skillalirezarezvani/claude-skills · by alirezarezvaniUse when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.★ 26.3k GitHub starsSkillCreate ERD diagrams, normalize database schemasDatabase schema designeralirezarezvani/claude-skills · by alirezarezvaniUse when the user asks to create ERD diagrams, normalize database schemas, design table relationships, or plan schema migrations.★ 26.3k GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars