AGENT SKILL

hnswlib

Use hnswlib 0.9.0 for CPU approximate nearest-neighbor search through its Python bindings or C++11 header-only API, including indexing, filtering, persistence, mutation, and recall checks.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
hnswlib
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use hnswlib 0.9.0 for CPU approximate nearest-neighbor search through its Python bindings or C++11 header-only API, including indexing, filtering, persistence, mutation, and recall checks.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

hnswlib

Use this repo skill when a task needs hnswlib for approximate nearest-neighbor (ANN) indexing, querying, filtering, persistence, updates, deletion/replacement, parameter tuning, or exact-recall comparison. The source contract is hnswlib 0.9.0. It exposes a CPU-native Python extension and a header-only C++11 API; it does not expose CUDA, ROCm, MPS, or a service/CLI.

Route first

Shared operating contract

  1. Identify the metric (l2, ip, or cosine), vector dimension, capacity, label type/policy, query k, target recall, and whether deletion, replacement, filtering, resizing, or persistence is required.
  2. Prefer the public package install (pip install hnswlib) when a compatible wheel exists. A source build needs NumPy, pybind11, a C++11 compiler, and the platform's native threading/OpenMP handling; use the installation reference.
  3. Keep k <= the eligible live population and set ef >= k. ANN quality and speed depend on both construction and search parameters; validate material recall claims against BFIndex or another exact oracle.
  4. Treat index files as binary artifacts tied to compatible metric/dimension and a deliberate capacity. Set ef again after file-based loading because file persistence resets it to the default; pickle preserves Python index state.
  5. Coordinate lifecycle phases. Do not overlap querying with adding, resizing, saving/loading, or destruction. Python filters should use one query thread; keep C++ spaces, filters, stop conditions, and buffers alive for each call.
  6. Use temporary or application-owned paths and bounded fixtures for smoke checks. Do not run large BigANN/SIFT downloads, benchmark-scale tests, or stress suites as a default operating workflow.

Minimum smoke checks

Python users should run the relevant bundled helper with --help and then a small default invocation from an environment where hnswlib is installed: sub-skills/python-bindings/scripts/python_lifecycle_smoke.py, python_filter_smoke.py, python_mutation_smoke.py, or python_pickle_smoke.py. C++ users should run sub-skills/cpp-header-api/scripts/run_cpp_smoke.sh --help, then provide an include root containing hnswlib/hnswlib.h.

Provenance and scope

Read references/repo-provenance.md when checking whether this skill matches a repository revision. Read references/repo-routing-metadata.json only as structured routing metadata; it is not an API manual.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351