Skip to main content

AsterVec: Persistent disk-oriented vector database for approximate nearest-neighbor search

Project description

AsterVec

The vector engine for on-device AI memory.

Quick Start · Install / Build · Python / C++ API · HTTP API

AsterVec lets AI applications run persistent vector search with much less system memory. It stores vectors and the largest graph layer on disk with Aster, a graph-oriented LSM-tree storage engine, while keeping only the hot navigation path in RAM. This makes retrieval practical on personal computers for AI agents and desktop RAG, while extending naturally to large-scale deployments.

Use AsterVec as a local vector retrieval layer in two modes:

  • Embed it (primary) — run the engine in-process for agent retrieval, RAG embeddings, and app-owned vector storage.
  • Serve it (optional) — run astervec_http when an app needs a local REST boundary.

Why AsterVec?

  • Minimal memory footprint. Unlike vector databases that hold the whole index in RAM, AsterVec is disk-oriented — memory stays small and predictable at scale.
  • Built for on-device retrieval. Disk-backed indexes keep persistent retrieval practical for agents, desktop RAG, and small servers.
  • Graph-in-LSM storage. AsterVec persists the largest HNSW layer in Aster RocksGraph, keeping only the upper navigation layers in memory.
  • Designed as an engine. Embed it into your app when retrieval state should stay local, private, and application-owned.

Features

  • Local retrieval engine — embed persistent vector search directly in Python or C++ applications.
  • Thread-safe embedded API — run search and incremental writes from application worker threads.
  • Agent/RAG-ready metadata — attach JSON payloads and filter retrieval with Mongo-style predicates ($eq, $gt, $in, $and, ...).
  • Mutable vector lifecycle — upsert vectors, update payloads, and delete ids without rebuilding the index.
  • Disk-backed HNSW — layer-0 edges live in Aster RocksGraph; upper layers stay in memory.
  • Graph-aware vector layout — AsterVec places graph-near vectors into shared 4 KB pages, then uses page caching and SQ8 compression to keep reads compact.
  • Fast initial loads — build an empty index in memory when embeddings fit in RAM; use streaming insert/update for incremental changes.
  • Optional service mode — expose the same engine through astervec_http when a REST boundary is useful.

Quick Start

AsterVec is embedded directly in your application. (Prefer a network service? See Run as an HTTP service.)

Python (import astervec)

git submodule update --init --recursive
make aster
python -m pip install .          # builds + installs the astervec module
import astervec

opts = astervec.AsterVecDBOptions()
opts.dim = 128
opts.vector_file_path = "./db/vectors.bin"
opts.reinit = True               # start fresh

db = astervec.AsterVecDB.open("./db", opts)

db.insert(1, [0.1] * 128, metadata={"source": "notes", "type": "snippet"})

# k-NN search → list[SearchResult(id, distance)]
for r in db.search_knn([0.1] * 128, k=10, ef_search=128):
    print(r.id, r.distance)

# filtered search → list[dict] of {"id", "distance"}
hits = db.search([0.1] * 128, k=10, filter={"source": "notes"})

db.close()

Both Python lists and NumPy float32 arrays are accepted. See the Python / C++ API reference and the Python SDK guide.

For initial loads, use bulk_build when the full embedding set fits in memory; use insert / update for incremental changes.

vectors = np.random.rand(100_000, 128).astype("float32")
report = db.bulk_build(vectors, threads=4)

C++

Include headers from include/ and link libastervec.a (static) or libastervec.so/.dylib. Transitive deps: rocksdb (Aster), zstd, pthread, dl (plus jemalloc on macOS).

#include "astervec_db.h"
using namespace astervec;

AsterVecDBOptions opts;
opts.dim = 128;
opts.vector_file_path = "./db/vectors.bin";
opts.reinit = true;

std::unique_ptr<AsterVecDB> db;
AsterVecDB::Open("./db", opts, &db);

std::vector<float> v(128, 0.1f);
db->Insert(1, v);

SearchOptions so; so.k = 10; so.ef_search = 128;
std::vector<SearchResult> results;
db->SearchKnn(v, so, &results);

db->Close();

How it works

AsterVecDB (public API — astervec_db.h)
  └─ AsterVec (HNSW index)
       ├─ RocksGraph (Aster)  — layer-0 graph edges on disk (LSM-tree)
       ├─ nodes_ map          — upper-layer edges in memory
       └─ IVectorStorage      — vectors on disk (graph-aware pages + cache + SQ8)

AsterVec keeps the hot navigation path small. Upper HNSW layers stay in memory, while layer-0 edges and vector data are stored on disk. Instead of laying vectors out by id, the vector store uses the HNSW search path to choose a section for each vector, so vectors likely to be visited together are co-located in 4 KB pages. A small page cache and SQ8 compression keep search practical under tight memory budgets.

Install / Build

The Quick Start above is the normal path for using AsterVec from Python or C++. This section is for local development, contributors, and source builds.

Prerequisites

  • C++17 compiler (GCC 8+ / Clang 10+), CMake ≥ 3.10, GNU Make, Boost (headers only)
  • zstd — the only required compression library (Aster is built with snappy / lz4 / bzip / zlib disabled)
  • jemalloc on macOS

Ubuntu / Debian

sudo apt-get install -y build-essential cmake libboost-dev libzstd-dev

macOS (Homebrew)

brew install cmake boost zstd jemalloc

Build

git submodule update --init --recursive
make aster
make
python -m pip install .

make produces the static/shared libraries and the astervec test/benchmark binary. To build the optional HTTP server, see Run as an HTTP service. python -m pip install . compiles the bindings via scikit-build-core (no separate make lib needed).

Run as an HTTP service (optional)

astervec_http exposes the same local engine over REST. Use it when an agent, desktop app, or local service needs a process boundary instead of embedding directly. It does not authenticate requests itself; run it behind your own reverse proxy if you need TLS or an API key.

# Build the server target (configured by default after `make`):
cmake --build build --target astervec_http -j
ASTERVEC_DATA_DIR=./data ./build/bin/astervec_http        # serves on :8000

# Or with Docker:
docker build -t astervec:latest .                        # needs lib/aster populated first
docker run -d --name astervec -p 8000:8000 -v "$(pwd)/data:/data" astervec:latest

See the full HTTP API reference for endpoint examples, metadata filters, and service configuration.

Configuration

Pass an AsterVecDBOptions to open. Common fields:

Field Default Description
dim 0 Required. Vector dimensionality.
metric L2 L2 or Cosine.
m 8 HNSW links per node (layer 0).
m_max 24 HNSW max neighbors, upper layers.
ef_construction 32.0 Candidate pool during construction.
ef_search 128 Default candidate pool during search.
paged_max_cached_pages 8192 Page cache size (4 KB pages).
reinit false true = wipe on open; false = reopen.
vector_file_path "" Path to the vector data file.

Higher m / ef_construction → better recall, slower build. Higher ef_search → better recall, slower queries. See API_REFERENCE.md for the complete list.

For service mode, use ASTERVEC_* environment variables; see HTTP_API.md.

Test binary / benchmarking

make also builds build/bin/astervec, a CLI harness that loads a dataset, builds the index, runs k-NN queries, and compares against ground truth — useful for benchmarking (not the way you'd use the engine in an app).

cd data && python prepare_sift_100k.py && cd ..
./build/bin/astervec --db ./run/db --data-dir ./data/sift_100k_ \
  --M 8 --Mmax 24 --efc 32 --k 10 --efs 128 --stats --out ./run/output.txt

Run ./build/bin/astervec --help for all flags (HNSW params, storage backend, batch read, etc.).

Troubleshooting

  • Aster RocksDB library or headers not found — build Aster first: git submodule update --init --recursive && make aster.
  • libzstd not found — install zstd (the only required codec): apt-get install libzstd-dev / brew install zstd.
  • FetchContent can't download pybind11 during pip install . — install pybind11 (pip install pybind11 or conda) and switch the FetchContent block in CMakeLists.txt to find_package(pybind11 REQUIRED).
  • externally-managed-environment on pip install . — use a virtualenv/conda environment.
  • cannot allocate memory in static TLS block (Linux, jemalloc) — preload jemalloc: LD_PRELOAD=/lib/x86_64-linux-gnu/libjemalloc.so.2 python your_app.py.
  • libastervec.so: cannot open shared object file — add the build dir to the loader path: export LD_LIBRARY_PATH=$PWD/build/lib:$LD_LIBRARY_PATH.

Contributing

Contributions are welcome. See CONTRIBUTING.md for source builds, tests, PR expectations, and issue reports.

License

Apache-2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

aster_vec-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

aster_vec-0.2.0-cp313-cp313-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

aster_vec-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

aster_vec-0.2.0-cp312-cp312-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

aster_vec-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

aster_vec-0.2.0-cp311-cp311-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

aster_vec-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

aster_vec-0.2.0-cp310-cp310-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

aster_vec-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

aster_vec-0.2.0-cp39-cp39-macosx_14_0_arm64.whl (2.8 MB view details)

Uploaded CPython 3.9macOS 14.0+ ARM64

File details

Details for the file aster_vec-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dfca8db38eaffbbd8d72120e956c7e18bc0782923868f980fadb965a09d0154b
MD5 7129e6409cc58224366397499f83ecca
BLAKE2b-256 6bb1a7b68d6795f2ae662c9cf5991ce12604bfe4f243f73241c14219197f979f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 cadbd35763525f591f1425a5da1280aaf58bfcbfa52f805a4fa18ff1992a4d60
MD5 0df8d4b677a2c61db153dbb51dcdf5a6
BLAKE2b-256 1889dcd1734aab4e08d91bdc57973bd8189921f7d913330a47b8f673c1c84918

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp313-cp313-macosx_14_0_arm64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 91fc6089d2fa589d6ffb4ec3b5f834f6d84317be4f287a16cd641dabead644ce
MD5 ef43f5a170095d151361e1007612cd05
BLAKE2b-256 bc27f726133a0de6e1030a2e8da55262a4a006abd58d2b2eaa492ee1a4b75987

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 c07b90f2428ba086ccbe1e346f316b0bbfe70df73f3f7657723f13179816f680
MD5 81b13df4ca09d770974d1fd9aa044296
BLAKE2b-256 670037543e803e9c4f700ce923f74a77d7f7faf3e5679f9067a799d8e27dab25

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp312-cp312-macosx_14_0_arm64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ce2952215a28ac36ce5d1c582b1d8e60cb34d1a137a84c9db591642a16de365
MD5 be2ced783c9494babca6d6f987b8cc68
BLAKE2b-256 715d40bb00d1034d3fdccdc8c40cd3890b4abd292529dd13b56b9456d7dc64e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 d79b1a4869a91cf19e8210b16185383ecced7fc683140fad7a8cf4cf9bc4e4b8
MD5 800eca9b96c1754afd0c52b758309752
BLAKE2b-256 144a2683becf2998eace4b84ba82fdfcaf8f2431202d363a7be72da23c0e6a28

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp311-cp311-macosx_14_0_arm64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 78e4210c1f4be48fb33550014cdd4bfa176c1d2e35dfb918783cc8c1a6633229
MD5 7ef9818ef676c5980deb177b02bee16c
BLAKE2b-256 d137225875f254a32c7df5b7d37783ce1d1e8c2979fc94221c29686d193cf9a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 9aadbeb4a1e2a90726aee538b0c39ea1e9f2d846ade10308baaaa0d19f6363d7
MD5 459fe22b7d3534fdc7c3bdfe8d7e6ae3
BLAKE2b-256 759e62d7e295174a75ce6fb85b2ef5797779d8bf6f26dd01c0f9945dffd9cce5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp310-cp310-macosx_14_0_arm64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fe6860910d3f56d9f24b0510c5fbe2630feb4024e3170334a9007a22bc4ebce3
MD5 41ab89b5a9e753f72328be65237e2de5
BLAKE2b-256 c9fbc6e9ba475974f5734f5700151106673513091c7904f49cf11b1091e22d1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aster_vec-0.2.0-cp39-cp39-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aster_vec-0.2.0-cp39-cp39-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 90b51a1fe9027543505f5bb6713046519f2b43c0fe51b28b56dbf4ca3a85d5ac
MD5 6bcd4c0e0cfc352515d3decfbdff600c
BLAKE2b-256 854454081412f84c4a43334d940323952fbe365c87749b183117304a6014e466

See more details on using hashes here.

Provenance

The following attestation bundles were made for aster_vec-0.2.0-cp39-cp39-macosx_14_0_arm64.whl:

Publisher: publish.yml on NTU-Siqiang-Group/AsterVec

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page