vector-lite

Crates.iovector-lite
lib.rsvector-lite
version0.1.12
created_at2025-03-05 21:13:50.859709+00
updated_at2025-03-07 16:48:38.778803+00
descriptionThe SQLite of Vector Database in Rust.
homepage
repositoryhttps://github.com/XiangpengHao/vector-lite
max_upload_size
id1579710
size86,883
Xiangpeng Hao (XiangpengHao)

documentation

https://docs.rs/vector-lite/latest/vector_lite/

README

VectorLite

Rust CI Crates.io Version docs.rs

The SQLite of Vector Database in Rust.

Features

  • Compact size
  • Zero-copy de/serialization from/to disk
  • Excellent search performance
  • WASM support
  • Minimal dependencies

Planned

  • Concurrent insert/delete/search
  • Support usage as external index for Parquet dataset.

Usage

use vector_lite::{VectorLite, Vector, ANNIndexOwned};

// Create a new index with 4 trees and leaf size of 10
const DIM: usize = 3;
let mut index = VectorLite::<DIM>::new(4, 10);
index.insert([1.0, 0.0, 0.0].into(), "101".to_string());
index.insert([0.0, 1.0, 0.0].into(), "102".to_string());
index.insert([0.0, 0.0, 1.0].into(), "103".to_string());
index.insert([0.7, 0.7, 0.0].into(), "104".to_string());

let query = [0.9, 0.1, 0.0].into();
let results = index.search(&query, 2);

for (id, distance) in results {
    println!("ID: {}, Distance: {}", id, distance);
}

index.delete_by_id("102".to_string());

// De/serialize from/to disk
let serialized = index.to_bytes();
let loaded_index = VectorLite::<DIM>::from_bytes(&serialized);

Benchmark

cargo bench --bench ann_benchmark "ANN Index Building/10000"

WASM

Need to build with wasm_js backend for getrandom crate.

env RUSTFLAGS='--cfg getrandom_backend="wasm_js"' cargo build --target wasm32-unknown-unknown

Notable users

VectorLite is the primary vector database used in Seen -- knowledge management for the impatient.

License

Apache-2.0

Commit count: 37

cargo fmt