"SUBSTRATE / faiss-zig"

faiss-zig

pre-1.0 . v0.7.0 . shipped 2026-05-22 . AGPL-3.0

44 unit tests . lane: inference

"WHY"

Vector search is the bottleneck that does not show up on the bill. The model is the cost line; the embeddings index is the latency line. The Python ecosystem ships FAISS as a C++ binding with a thin Python facade, which means the operator who owns the model still does not own the retrieval path. The retrieval path is where RAG, agent memory, semantic cache, and recommendation routing all funnel through, and it is the layer where lock-in compounds quietly through serialised index formats and pinned wheel versions.

faiss-zig is the retrieval substrate. Pure Zig, no C++ dependency, no pinned wheel. The four index families it carries (Flat, HNSW, IVFFlat, IVFPQ) cover the operating envelope from small-N exact search to large-N memory-compressed approximate search. The point is not to outrun FAISS; the point is to remove the C++/Python wedge from the retrieval-layer audit and to keep the index format inside the same single-binary deployment envelope as the rest of the Sovereign Stack.

"WHAT"

Four index families. Each is the standard published algorithm, named honestly.

The end-to-end claim is composability with the rest of the inference stack. faiss-zig accepts the embeddings vllm-zig emits at its final hidden-state head, the index sits in the same Zig binary as the forward pass, and the retrieved prefix re-enters the forward pass without crossing an FFI boundary or a Python interpreter.

"MILESTONES"

"DEPENDENCIES"

"ADAPTER TARGETS"

"RELATED CANON"

"RELATED LAB NOTES"

"RELATED WORKSHOP"

The v0.7 to v0.8 work (cosine and inner-product on IVFPQ; OPQ rotation matrix; parallel k-means assignment) is queued. Workshop entry forthcoming on the next ship.

"LIMITS"

Pre-1.0 substrate, named honestly.

"SOURCE"

"INSTALL"

git clone https://github.com/SMC17/faiss-zig.git
cd faiss-zig
zig build -Doptimize=ReleaseFast
zig build test

Zig 0.16.0 required. No external dependencies, no system-library link, no Python runtime in the path. Single-binary deployment envelope.

"DOWNLOAD"

"CITATION"

@software{collins_faiss_zig_2026,
  author       = {Collins, Sean},
  title        = {{faiss-zig: Pure-Zig Vector Similarity Search}},
  version      = {v0.7.0},
  year         = {2026},
  month        = {5},
  url          = {https://sunlitmoon.online/substrate/faiss-zig.html},
  note         = {AGPL-3.0-or-later. Source: github.com/SMC17/faiss-zig.}
}