alibaba / zvec

Alibaba / Zvec

Zvec is an open-source, in-process vector database — lightweight, lightning-fast, and designed to embed directly into applications. Battle-tested within Alibaba Group, it delivers production-grade, low-latency and scalable similarity search with minimal setup.

Zvec 是一款开源的进程内(in-process)向量数据库,它轻量、极速,专为直接嵌入应用程序而设计。该项目已在阿里巴巴集团内部经过实战检验,能够以极简的配置提供生产级、低延迟且可扩展的相似度搜索能力。

Important 🚀 v0.5.0 (June 12, 2026)

重要更新 🚀 v0.5.0 (2026年6月12日)

  • Full-Text Search (FTS): Native full-text search — attach an FTS index to any string field and query it with natural-language or structured expressions, no external search engine required. 全文搜索 (FTS): 原生全文搜索功能——可为任何字符串字段添加 FTS 索引,并使用自然语言或结构化表达式进行查询,无需依赖外部搜索引擎。
  • Hybrid Retrieval: Combine full-text and vector search in a single MultiQuery across dense vectors, sparse vectors, scalar filters, and text. 混合检索: 在单次 MultiQuery 中结合全文搜索与向量搜索,支持稠密向量、稀疏向量、标量过滤和文本的综合查询。
  • DiskANN Index: New on-disk index that keeps the bulk of the index on disk, drastically cutting memory usage for large-scale datasets. DiskANN 索引: 全新的磁盘索引,将大部分索引数据保留在磁盘上,大幅降低了大规模数据集的内存占用。
  • Ecosystem & Platforms: New official Go / Rust SDKs, the Zvec Studio visual tool, and RISC-V support. 生态与平台: 新增官方 Go/Rust SDK、Zvec Studio 可视化工具,并支持 RISC-V 架构。

💫 Features

💫 功能特性

  • Blazing Fast: Searches billions of vectors in milliseconds. 极速性能: 在毫秒级时间内完成数十亿向量的搜索。
  • Simple, Just Works: Install and start searching in seconds. Pure local, no servers, no config, no fuss. 简单易用: 安装后几秒钟即可开始搜索。纯本地运行,无需服务器、无需配置、零负担。
  • Dense + Sparse Vectors: Support dense and sparse embeddings, multi-vector queries, and a rich selection of vector index types that scale from memory to disk. 稠密 + 稀疏向量: 支持稠密和稀疏嵌入、多向量查询,以及从内存到磁盘可扩展的多种向量索引类型。
  • Full-Text Search (FTS): Native keyword-based full-text search — query string fields with natural-language or structured expressions. 全文搜索 (FTS): 原生基于关键词的全文搜索——支持使用自然语言或结构化表达式查询字符串字段。
  • Hybrid Search: Fuse vector similarity, full-text search, and structured filters in a single query for precise results. 混合搜索: 将向量相似度、全文搜索和结构化过滤融合在单次查询中,以获得精准结果。
  • Durable Storage: Write-ahead logging (WAL) guarantees persistence — data is never lost, even on process crash or power failure. 持久化存储: 预写日志 (WAL) 保证了数据持久性——即使进程崩溃或断电,数据也不会丢失。
  • Concurrent Access: Multiple processes can read the same collection simultaneously; writes are single-process exclusive. 并发访问: 支持多个进程同时读取同一个集合;写入操作则为单进程独占。
  • Runs Anywhere: As an in-process library, Zvec runs wherever your code runs — notebooks, servers, CLI tools, or even edge devices. 随处运行: 作为进程内库,Zvec 可以在任何代码运行的地方工作——无论是笔记本、服务器、CLI 工具还是边缘设备。

📦 Installation

📦 安装指南

Zvec offers official SDKs across multiple languages: Zvec 提供多种语言的官方 SDK:

  • Python: pip install zvec (requires Python 3.10–3.14)
  • Node.js: npm install @zvec/zvec
  • Go: High-performance Go bindings. (高性能 Go 绑定)
  • Rust: High-performance Rust bindings. (高性能 Rust 绑定)
  • Dart/Flutter: flutter pub add zvec

Prefer a visual tool? Try Zvec Studio to browse data and debug queries — no code required. 喜欢可视化工具?尝试使用 Zvec Studio 来浏览数据和调试查询——无需编写代码。

✅ Supported Platforms

✅ 支持平台

  • Linux (x86_64, ARM64)
  • macOS (ARM64)
  • Windows (x86_64)

🛠️ Building from Source

🛠️ 从源码构建

If you prefer to build Zvec from source, please check the Building from Source guide. 如果您倾向于从源码构建 Zvec,请查阅“从源码构建”指南。

⚡ One-Minute Example

⚡ 一分钟示例

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.VectorQuery("embedding", vector=[0.4, 0.3, 0.3, 0.1]),
    topk=10
)

# Results: list of {'id': str, 'score': float, ...}, sorted by relevance
# 结果:包含 {'id': str, 'score': float, ...} 的列表,按相关性排序
print(results)

📈 Performance at Scale

📈 大规模性能

Zvec delivers exceptional speed and efficiency, making it ideal for demanding production workloads. For detailed benchmark methodology, configurations, and complete results, please see our Benchmarks documentation. Zvec 提供卓越的速度和效率,非常适合高要求的生产工作负载。有关详细的基准测试方法、配置和完整结果,请参阅我们的基准测试文档。

❤️ Contributing

❤️ 贡献指南

We welcome and appreciate contributions from the community! Whether you’re fixing a bug, adding a feature, or improving documentation, your help makes Zvec better for everyone. Check out our Contributing Guide to get started! 我们欢迎并感谢社区的贡献!无论是修复 Bug、添加功能还是改进文档,您的帮助都能让 Zvec 变得更好。请查看我们的贡献指南以开始参与!