Website · Pricing · Pilot Access
VCAL-core is a lightweight, in-process HNSW vector index written in safe Rust with optional SIMD and atomic snapshots.
It’s designed as a minimal building block for semantic caches (e.g., LLM prompt deduplication) and embedded ANN search.
MSRV: 1.56 (edition 2021). Dev-dependencies may require a newer stable toolchain.
- Ultra-light: minimal dependencies, no
unsafein public API. - Fast enough: competitive k-NN for small/mid indexes (edge or cache use).
- Embeddable: no daemon — runs directly inside your process.
- Deterministic: single-threaded core; wrap in
RwLockfor concurrency. - Persistent: safe paired snapshots and simple TTL/LRU eviction.
- HNSW index with greedy descent +
ef_search - Pluggable metrics:
Cosine(default),Dot - Optional SIMD (
--features simd+RUSTFLAGS="-C target-cpu=native") - Snapshots: binary persistence with the
serdefeature- Atomic paired saves prevent corruption (
.index.A/.index.B) - Automatic recovery from latest intact snapshot
- Atomic paired saves prevent corruption (
- Eviction:
evict_ttl(ttl_secs)— remove expired entriesevict_lru_until(max_vectors, max_bytes)— respect soft caps
- Stats:
stats()→(vector_count, approx_bytes) - Simple API:
insert,delete,contains, andsearch
[dependencies]
vcal-core = { version = "0.1.1", features = ["serde"] }Optional features:
serde— enable snapshot persistencesimd— AVX2-optimized inner loops (x86_64only)
use vcal_core::{HnswBuilder, Cosine};
let mut idx = HnswBuilder::<Cosine>::default().dims(128).build();
idx.insert(vec![0.1; 128], 1001)?;
let hits = idx.search(&vec![0.1; 128], 5)?;use vcal_core::Index;
use std::fs::File;
let idx = Index::new(...)?;
let f = File::create("vcal.index")?;
idx.save(f)?; // alternates between paired files safelyPaired saves guarantee atomic recovery: on restart, load() automatically picks the last valid .index version.
idx.evict_ttl(3600); // Remove expired entries
idx.evict_lru_until(Some(1000), None); // Keep up to 1000 vectorsvcal-core itself is metrics-agnostic.
For Prometheus and Grafana integration, use vcal-server, which exposes /metrics.
- Build in release mode:
cargo build --release - Use native SIMD:
RUSTFLAGS="-C target-cpu=native" cargo build --release --features simd - Normalize embeddings for cosine metric.
- Typical parameters:
m = 16–32,ef_search = 64–256.
- No background threads or implicit I/O.
- No public
unsafe. - Snapshot format is stable for 0.x line, versioned from
v0.1.0. - Optimized for embedded and server-local caches, not massive-scale ANN.
For Python and chatbot integration, see INSTALL.md.
Licensed under Apache-2.0. See LICENSE-Apache-2.0
© 2026 VCAL-project contributors