Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Comparison of Local Text Embedding and Vector Search Tools

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Summary

The Three Layers of a Local Semantic Search Stack

When comparing tools for local semantic search, tag suggestion, or cross-reference retrieval, it helps to separate them into three distinct layers:

  1. Embedding generation (text → vector): fastembed, model2vec, sentence-transformers, ollama, scikit-learn (TF-IDF). FAISS cannot replace this layer; you still need one of these tools to produce vectors.

  2. Vector indexing & similarity search (vector → top-K neighbors): FAISS, sqlite-vec, plain numpy. This is the layer where FAISS competes.

  3. All-in-one pipelines (embed + index + query): txtai (which wraps FAISS as its default ANN backend) and llm (llm embed / similar).

Embedding Generation Tools

Table 1:Local Text Embedding Tools Comparison

Embedding Tool

Status

Semantic?

Runtime & Footprint Notes

Language

License

Popularity

fastembed

Active

Y

ONNX Runtime; no PyTorch; ~15–45s CPU for ~2.2k posts

Python

Apache-2.0

~3.3k ★

model2vec

Active

Y[1]

Distilled static embeddings + NumPy; ~1–3s CPU for ~2.2k posts

Python

MIT

~2.3k ★

sentence-transformers

Active

Y

Full PyTorch dependency (~2+ GB); broad model ecosystem

Python

Apache-2.0

~19.3k ★

ollama

Active

Y

Local daemon (e.g., nomic-embed-text); convenient if already running

Go

MIT

~188.0k ★

scikit-learn (TF-IDF)

Active

N[2]

Zero neural models; <1s CPU; strong lexical baseline

Python

BSD-3-Clause

~68.3k ★

Vector Search & All-in-One Tools (FAISS vs. Alternatives)

Table 2:Vector Search and All-in-One Tools Comparison

Vector Search Tool

Status

Generates Embeddings?

Stores Metadata?

Search Type

Best Scale

Language

License

Popularity

SQLite + NumPy (baseline)

N/A

N

Y[3]

Exact

<50k vectors

Python

N/A

N/A

sqlite-vec

Active

N

Y[4]

Exact / KNN

<500k vectors

C

MIT / Apache-2.0

~8.3k ★

FAISS

Active

N

N[5]

Exact & ANN[6]

100k–1B+ vectors

C++

MIT

~41.9k ★

txtai

Active

Y

Y

Exact & ANN[7]

1k–10M+ vectors

Python

Apache-2.0

~13.7k ★

llm

Active

Y[8]

Y

Exact

<50k vectors

Python

Apache-2.0

~12.8k ★

How FAISS Compares in Practice

Hybrid Local + Low-Tier LLM Pattern

For repeated workflows like auto-suggesting tags and cross-references across a personal knowledge base or blog, combining local embeddings with an optional low-tier LLM avoids both high token costs and context-window limits:

  1. Incremental SQLite cache (content_sha256): Store (doc_path, content_sha256, embedding BLOB) in a standalone SQLite database so only new or modified documents are re-embedded.

  2. Stage 1 — Local retrieval ($0 tokens): Compute nearest neighbors locally with numpy (or sqlite-vec / FAISS at larger scale) to surface candidate cross-references and weighted kNN tag votes.

  3. Stage 2 — Optional low-tier LLM reranking (gradual batches): Pass only the target document plus its top-K local neighbors (~1k tokens/document) to a fast, low-cost model when higher-precision curation is desired.

References

Footnotes
  1. Distilled static embeddings are ultra-fast on CPU with minimal footprint, with slightly lower semantic nuance than full transformer models like BGE.

  2. Lexical TF-IDF + cosine similarity; fast and zero-ML, but misses synonyms and conceptual matches (e.g., Podman vs. Docker).

  3. Metadata, content_sha256 hashes, and float32 vector BLOBs live in one SQLite DB; cosine similarity runs in RAM via numpy.

  4. Runs as a SQLite extension inside the same DB file as document metadata and hashes.

  5. Stores vectors and integer IDs only; requires a separate metadata store (e.g., SQLite) and ID-sync logic on updates/deletes.

  6. Supports IVF, PQ, HNSW, and optional GPU acceleration (faiss-gpu).

  7. Uses FAISS as its default ANN backend while bundling embedding models and metadata storage.

  8. Supports local embedding plugins via llm embed and similarity lookup via llm similar.