# Repository Briefing: alibaba/zvec
> Source: https://repoforai.com/repo/alibaba/zvec (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/alibaba/zvec
- **Official Docs / Website**: https://zvec.org
- **Category**: RAG, Data & Memory (知识库 / 爬虫 / 记忆层)
- **Primary Language**: C++
- **License**: Apache-2.0
- **Engineering Health**: A+ (94/100 · Maintenance 35/35 · Adoption 19/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v0.8.1 (2026-11-06) — https://github.com/alibaba/zvec/releases
- **Review Snapshot**: 2026-12-01
- **Deployment / Stack Signals**: Self-Hosted, Local AI
- **Momentum**: 16,322 ★ total (+7 24h / +29 7d) · 1,030 forks
- **Topics**: `agent-skills`, `db`, `embedded`, `faiss`, `fts`, `fulltext-search`, `hnsw`, `llm-memory`, `local`, `rag`, `search-engine`, `semantic-search`
- **When to Use**: Best for: Local RAG, desktop or edge search, and application-owned retrieval where a designated writer can maintain the collection and hybrid search should run without a separate database service. Skip if: Multiple services need to write independently to a shared corpus, or you need a managed remote database and do not want to own storage, recovery, and write coordination.

## Overview
```text
### Architecture & Core Mechanics
Zvec is a persistent, in-process retrieval engine, not a standalone database service. The C++ core lives under `src/`, with a top-level `CMakeLists.txt` and Python integration under `python/`. Python calls the native engine through pybind11. The Python flow is schema-first: declare the collection and vector field, open a collection at a filesystem path with `zvec.create_and_open`, insert `zvec.Doc` records, then query a field with `zvec.Query` and `topk`.

The host application supplies embeddings; Zvec handles local storage and retrieval. Write-ahead logging supports durability, and multiple processes can read the same collection while writes are exclusive to one process. SDKs give applications a way to embed the engine in different runtimes. If retrieval must be shared over the network, the application needs to expose and operate that service boundary.

### Key Capabilities & Differentiators
Zvec supports dense and sparse embeddings, multi-vector queries, and hybrid retrieval that combines vector similarity, native full-text search, and structured filters. Full-text search runs on string fields and accepts natural-language or structured expressions. Since v0.8.0, the default Jieba dictionary and HMM model ship together, so Chinese tokenization needs no separate dictionary deployment.

HNSW, IVF, and DiskANN give teams index choices across memory- and disk-oriented workloads. v0.8.1 adds PQ4/PQ8 and optional OPQ to HNSW and IVF, covering training, search, persistence, and later updates. The cited GIST 1M benchmark setup uses L2 distance, INT8 quantization, and HNSW on a 16-core Linux ARM64 system. Treat that as one configuration, not a latency forecast for different data, hardware, or filters.

### Trade-offs & Limitations
Compared with managed Pinecone, Zvec removes the network hop between the application and retrieval engine and lets you keep the collection local. The trade-off is ownership: your team provisions storage, tests backup and restore, and coordinates writes. Multiple reader processes do not imply multiple writers. If several services must ingest into one corpus, route updates through a designated writer or choose a deployment model that handles shared writes for you.

The engine also consumes resources on the same host as the application. Size for build and merge peaks as well as steady-state queries, and measure recall on representative queries before choosing a quantizer. Uniform quantization can speed search, but a shared min/max range can introduce more error and lower recall. The Python package is classified as Alpha; before a production rollout, exercise crash recovery and upgrades under your intended reader/writer workload.

### Hardware & Deployment Guide
The shortest Python path is `pip install zvec`, followed by opening a collection on a writable local path. Use a supported 64-bit interpreter: installation guidance lists Python 3.10–3.14, while `pyproject.toml` declares a `>=3.9` lower bound. Check wheel availability for the exact Python version, OS, and architecture rather than assuming that the metadata guarantees a compatible build. Java requires Java 8 or newer; official SDKs are also available for Node.js, Go, Rust, and Dart/Flutter.

There is no separate database daemon to deploy for embedded use. Retrieval can run offline if the collection and any upstream embedding dependencies are available locally. v0.8.0 added Intel Mac and Windows ARM64 builds, wheels, and SDKs, and reduced peak memory during IVF and DiskANN builds and merges. v0.8.1 expanded RaBitQ coverage to more platform combinations. Check the feature-level platform matrix before standardizing on an index or quantizer.
```

## Key Capabilities
```text
- Execution model: Native C++ engine with pybind11 bindings; Python opens a collection at a local filesystem path.
- Retrieval: Dense, sparse, and multi-vector queries alongside native full-text search and structured filters.
- Chinese text search: v0.8.0 bundles the Jieba dictionary and HMM model, removing the need to provision them separately.
- Index compression: v0.8.1 adds PQ4/PQ8 and optional OPQ for HNSW and IVF, covering training, search, persistence, and updates.
- Concurrency and durability: WAL-backed persistence and concurrent readers across processes, with writes exclusive to one process per collection.
- Build resource controls: v0.8.0 reduces peak memory during IVF and DiskANN builds and merges and tightens enforcement of configured build and training thread limits.
```

## Quick Start / Clone
```bash
import zvec

# Define collection schema
schema = zvec.CollectionSchema(
    name="example",
    vectors=zvec.VectorSchema("embedding", zvec.DataType.VECTOR_FP32, 4),
)

# Create collection
collection = zvec.create_and_open(path="./zvec_example", schema=schema)

# Insert documents
collection.insert([
    zvec.Doc(id="doc_1", vectors={"embedding": [0.1, 0.2, 0.3, 0.4]}),
    zvec.Doc(id="doc_2", vectors={"embedding": [0.2, 0.3, 0.4, 0.1]}),
])

# Search by vector similarity
results = collection.query(
    zvec.Query(field_name="embedding", vector=[0.4, 0.3, 0.3, 0.1]),
    topk=10
)

# Results: list of {'id': str, 'score': float, ...}, sorted by relevance
print(results)
```
