More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    FAISS: Pick the Right Index for Your Scale

    1

    Pick the right FAISS index for your scale and accuracy budget: a sizing decision tree across Flat, IVF, HNSW, and PQ, plus training, tuning, GPU, and persistence guidance.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    FAISS: Pick the Right Index for Your Scale

    FAISS: Pick the Right Index for Your Scale

    Example session with this skill installed

    We have a 400k-chunk support knowledge base, 768-dim embeddings, and we need recall@5 of at least 0.95 with p99 latency under 50ms on CPU. Pick the index and tune it.

    • Read your context and instructions
    • Compiled the faiss

    Support-docs retrieval — index chosen and tuned with the skill

    Decision tree: Flat is exact but too slow at 400k; HNSW is faster to query but hungrier for RAM and the latency budget is generous; IVF wins — simpler to operate, and the budget leaves headroom. nlist = 1024 (square root of 400k is 632; rounded up for recall headroom), trained on a 100k representative sample from the same corpus — not random vectors, which would silently destroy recall.

    Tuning loop (Flat baseline on a sample, real queries from the support logs, not synthetic):

    • nprobe = 8 → recall@5 0.91, p99 14ms — below target.
    • nprobe = 16 → recall@5 0.96, p99 22ms — target met with headroom.

    Shipped: IVF, nprobe=16. The trained index is written to disk once with write_index; the serving process memory-maps it at startup, and is_trained is asserted at load time. The training sample was drawn from the same corpus, stratified by document type, so the centroids reflect what the index will actually serve. A nightly job rebuilds from the updated corpus — retraining, not incremental adds, because cluster centroids drift as content changes and drift erodes recall quietly. Rubric score: 9/10 — one point held back because the GPU build path was not exercised; the index was built on CPU and the GPU option is recorded as a follow-up.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    FAISS is the engine underneath most retrieval-augmented generation pipelines — and the whole skill reduces to one decision: which index type, because everything else follows from it. This skill gives you the sizing decision tree (Flat under ~10k, IVF for 10k–1M, HNSW at 1M+ when RAM allows and quality matters, IVF+PQ when memory-bound), the cost of each index in plain terms, and the tuning loop that settles boundary cases: build a Flat baseline, measure recall@k on real queries, raise nprobe or efSearch until the target is met, and move to a stronger index when latency is still too high at target recall.

    You get the silent-failure guards that matter most — float32 dtype, normalized vectors for inner product, is_trained asserted before the first add, training data that resembles the indexed data, never retraining in the request path — plus a tuning-run log template, a checklist, and a scoring rubric with a ship threshold of 8/10. A worked example tunes a 400k-chunk support-docs index to recall@5 of 0.96 at 22ms p99, with nightly rebuilds instead of incremental adds because centroids drift.

    • It is a library, not a database: no metadata filtering, no auth, no replication — use a vector database when you need those.
    • It does not cover embedding-model selection; the vectors are assumed to exist and be good.
    • Published benchmark numbers are not your numbers; every tuning result here is measured on your own queries.
    • Datasets under ~10k vectors do not need FAISS at all — Flat search in numpy is fine.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 3 days ago

    Permissions

    No special permissions declared or detected

    Listed3 days ago

    What's inside

    Frequently Asked Questions

    Because it is the hungriest for RAM and the slowest to build. When the latency budget is generous, IVF is simpler to operate and cheaper to serve. The decision tree exists because the right index depends on scale, budget, and memory — not on which index is fastest in a benchmark.

    The parameter is not the problem. Check the training data first — if it does not resemble the indexed data, recall is capped no matter what nprobe you set. Then consider a different index. Raising nprobe further just buys latency.

    The classic silent failure: it was never trained. Searching an untrained IVF index returns garbage without an error. Assert `is_trained` after training and again at load time — one line, and the whole class of failure disappears.

    New in LLM Ops