Skip to content

Vector search as an optional feature-gated vertical #29

Description

@nicholasjpaterno

Summary

TurboVault's built-in semantic search (TF-IDF) is a strong low-resource default and will stay the default. This issue tracks adding true embedding-based semantic search as an optional, feature-gated vertical for larger or more semantically diverse vaults, where dense embeddings meaningfully improve recall over lexical/TF-IDF approaches.

This is not a replacement for TF-IDF. It is an opt-in upgrade, off by default, so the common case (modest vault, zero-config, instant, offline, private) is unaffected.

Prior art

@ForrestThump has a working prototype on his feature/vector-db branch (CPU-friendly embeddings, paragraph-level incremental re-embedding, gated behind a vector-search feature) — excellent reference material. To be clear, this is open for anyone to pick up; no assumption about who authors it, and ForrestThump is very welcome to drive it if he has the bandwidth.

Architecture direction (from a Q2 2026 review)

Design it as a vertical that abstracts the embedder (and optional reranker) behind traits, defaults to a pure-Rust CPU stack, and gates heavier backends behind features.

Tier 1 — default backend (pure-Rust, CPU, edge-friendly)

  • Static embeddings via model2vec-rs + hnsw_rs (pure Rust, zero FFI; cross-compiles cleanly to Pi/musl/WASM).
  • Model: Potion potion-mxbai-256d-v2 (~71.45 MTEB v2 English, 15k+ sentences/sec on CPU, 256-dim so the index stays small); potion-mxbai-micro (~0.7 MB) for the edge floor.
  • Static embeddings have closed most of the gap with small transformers while being orders of magnitude faster and smaller — a good fit for the local-first ethos.

Tier 2 — optional quality upgrade (heavier dependency)

  • Quantized transformers via fastembed-rs (ONNX, int8): Qwen3-Embedding-0.6B (Matryoshka 256–2048 dims, Apache-2.0) or Nomic Embed v2 (CPU-purpose-built, single-model dense+sparse hybrid).

Tier 3 — optional reranker (highest quality per cost)

  • FlashRank-class on CPU (sub-20 ms for ~50 candidates), or mxbai-rerank-xsmall / jina-reranker-v3 for higher quality.

Hybrid note: TurboVault already has Tantivy BM25. The strongest retrieval path is BM25 + dense + RRF, then optional rerank — mostly assembled from parts that already exist.

Suggested shape

  • Lands as crates/plugins/turbovault-plugin-vector-search, behind a vector-search feature, default-off (depends on the Phase 1 provider scaffolding, [Phase 1] Decompose tools.rs into composable providers #28).
  • Small / Matryoshka vectors by default (256d) to keep the index cheap.
  • Incremental re-embedding driven by the vault-event/hook system (yolo #24) — re-embed only changed content.

Open questions

  • Persistence: pure-Rust hnsw_rs (no deps) vs sqlite-vec / usearch (SQL + persistence, but C/C++ FFI).
  • Whether to expose reranking from day one or as a follow-up.
  • Eventually: is a static backend good and light enough to be promoted toward the default? Decide with real benchmarks, not up front.

Caveats

  • MTEB v2 scores are not comparable to v1, and they are self-reported. The decisive test is performance on a real vault (MRR / NDCG on your own corpus).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions