sdan/vlite
fastest vector database made in numpy
vlite – a tiny, fast vector database for RAG
What it is – vlite is a pure‑Python vector store that lets you embed texts, index them, and retrieve the most similar items without running a separate database server. It stores everything in a single CTX file (think of it as a portable “cookie” for embeddings) and relies only on NumPy, so installation is a single pip install vlite.
Why it matters – Retrieval‑augmented generation (RAG) and AI agents need cheap, low‑latency similarity search. The README claims:
- Retrieval of 500 k documents in under 1.1 s.
- Indexing > 77 % faster and retrieval > 422 % faster than Chroma, with a disk footprint 3.6 × smaller.
- Built‑in support for the mixedbread‑embed‑xsmall model, automatically chunking long texts to the model’s 512‑token window.
Key concepts
- CTX file – a binary format that bundles the embeddings, raw texts, and optional metadata. It can be moved around like a cookie and re‑loaded with
VLite(name). - Metadata filtering – you can attach a dict to each entry and later query with a
whereclause. - Chunking – long strings are split automatically to fit the embedding model’s context size.
Typical workflow
from vlite import VLite
db = VLite("my_collection")
# add raw strings (optionally with metadata)
db.add(["some text", "more text"], metadata={"source": "book"})
# retrieve the nearest neighbours
for _, text, _, dist in db.retrieve("search query", top_k=3):
print(dist, text)
# persist to disk (creates contexts/my_collection.ctx)
db.save()
On the first run the library downloads the 48 MB mixedbread embedding model to ~/.cache/vlite.
Who it’s for – developers building:
- ChatGPT plugins or other LLM‑powered plugins
- Autonomous agents that need a lightweight context store
- Prototypes or small‑scale production services where running a full‑blown vector DB (e.g., Pinecone, Milvus) would be overkill.
License – AGPL‑3.0, meaning any derivative that is deployed as a service must also be open‑sourced under the same license.
Contributing – The project acknowledges contributions from Claude (the AI assistant) and a GitHub user named Ray. Issues and pull requests are welcomed.
All information above is taken directly from the repository’s README.
Related
- Project
- Project
- Project
- Project