Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

spheni

> 编程语言
Open source

Lightweight Vector Search Library focused on Memory Efficiency

187 stars0 likes1 views
WebsiteGitHub

About

Lightweight Vector Search Library focused on Memory Efficiency

Spheni

A lightweight vector search library focused on memory-efficient approximate nearest neighbor search.

Index

  1. Overview
  2. Features
  3. Getting Started
  4. API Reference
  5. Benchmarks
  6. Roadmap
  7. References

Overview

The goal of Spheni is to be focused on memory efficiency rather than accuracy, and act a candidate generation system.

It implements inverted indexing and product quantization with residual encoding to reduce memory usage while supporting fast similarity search.

With Cohere 1M Embeddings, the current benchmark reports up to 213.9x compression (13.69 MB index at M=8) and up to 94.20% Recall@10-in-100 (M=64, nprobe=32), with the baseline at 80.1x compression and 83.25% Recall@10-in-100 (M=32, nprobe=32).

Features

  • Indexes: Flat, IVF, FlatPQ, IVF-PQ
  • Metrics: Cosine similarity, L2 distance
  • Operations: train, add, search

Getting Started

Build

Requirements:

  • CMake >= 3.15
  • A C++20 compiler (GCC/Clang)

Quick build

bash
chmod +x build.sh
./build.sh

After building, this repository produces build/libspheni.a. You only need the public header (include/spheni.h) and the static library (libspheni.a) to consume Spheni in another project.

Usage

bash
g++ -std=c++20 -O3 main.cpp -I /path/to/spheni/include /path/to/libspheni.a -o main

Example

Check out examples/ folder for more.

…

API Reference

Detailed public API documentation is available in docs/api-reference.md.

Benchmarks

Current Benchmark Report (single-core run, 200 queries, Recall@k-in-100).
Legacy Report is also available.

Roadmap

  • Implement save/load for seralized data
  • Implement multithreading with OpenMP wherever applicable
  • Implement OPQ (tough for me)
  • SIMD vectorizations

References

Papers

  1. FAISS: ArXiv Paper
  2. Near Neighbor Search in Large Metric Spaces
  3. The Binary Vector as the Basis of an Inverted Index File
  4. Product Quantization for Nearest Neighbour Search

Blogs

  1. A Bhayani - Product Quantization
  2. W Lin - Building a high recall vector database serving 1 billion embeddings from a single machine

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++approximate-nearest-neighbor-searchinverted-indexproduct-quantization

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言