Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
74da77a
refactor: use dlopen
richyreachy Jun 24, 2026
17a7fd5
refactor: use dlopen to load libaio
richyreachy Jun 25, 2026
8ef5d2d
fix: log out the warning only once
richyreachy Jun 26, 2026
50c6c8d
fix: add log
richyreachy Jun 26, 2026
ceee226
fix: add log
richyreachy Jun 26, 2026
5e77ee3
Merge branch 'refactor/diskann_dlopen' of github.com:richyreachy/zvec…
richyreachy Jun 26, 2026
6d774ed
refactor: merge main
richyreachy Jun 26, 2026
e2a2ede
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jun 30, 2026
a2524eb
fix: fix windows build
richyreachy Jul 1, 2026
ac109ae
Merge branch 'refactor/diskann_dlopen' of github.com:richyreachy/zvec…
richyreachy Jul 1, 2026
6688e1a
fix: remove libaio dependency
richyreachy Jul 1, 2026
760fb7a
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 2, 2026
f2559b5
fix: remove no use code
richyreachy Jul 2, 2026
d753080
fix: fix makefile
richyreachy Jul 2, 2026
bc7b843
Merge branch 'refactor/diskann_dlopen' of github.com:richyreachy/zvec…
richyreachy Jul 2, 2026
292322c
fix: fix ut
richyreachy Jul 3, 2026
a0a9ce9
fix: remove export map
richyreachy Jul 3, 2026
69b1e23
fix: clean code
richyreachy Jul 3, 2026
081aee3
fix: add ci job to test libaio
richyreachy Jul 3, 2026
058c67c
feat: add diskann on arm
richyreachy Jul 6, 2026
ab8901a
fix: fix on comment
richyreachy Jul 6, 2026
63f5ff7
fix: remove diskann runtime
richyreachy Jul 6, 2026
30a08f8
fix: fix ut
richyreachy Jul 7, 2026
5ffc23a
refactor: move libaio loader to ailego
richyreachy Jul 7, 2026
8bf1f15
fix: fix merge
richyreachy Jul 7, 2026
1c7ff60
fix: add io backend
richyreachy Jul 7, 2026
54eaa11
fix: add io backend
richyreachy Jul 7, 2026
d2fba31
fix: fix memcpy
richyreachy Jul 7, 2026
9870923
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 7, 2026
716adb9
fix: fix warning
richyreachy Jul 7, 2026
f19defb
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 7, 2026
241dd7a
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 8, 2026
e1048c0
fix: remove ci
richyreachy Jul 8, 2026
fde7813
fix: add ci
richyreachy Jul 8, 2026
6496a0b
Merge branch 'refactor/diskann_dlopen' of github.com:richyreachy/zvec…
richyreachy Jul 8, 2026
4567d99
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 8, 2026
ca89c30
fix: debug output
richyreachy Jul 8, 2026
01b702c
fix: run ci
richyreachy Jul 8, 2026
69144b5
Merge branch 'main' into feat/diskann_on_arm_new
richyreachy Jul 8, 2026
e0b12db
Merge branch 'main' into refactor/diskann_dlopen
richyreachy Jul 9, 2026
8dca6a6
fix: link core_knn_diskann in index_group_by_test
richyreachy Jul 9, 2026
11940a7
Merge branch 'refactor/diskann_dlopen' into feat/diskann_on_arm_new
richyreachy Jul 9, 2026
b7d0b0f
fix: fix make
richyreachy Jul 9, 2026
86806b4
support O_DIRECT
iaojnh Jul 13, 2026
e9dafa6
upd
iaojnh Jul 16, 2026
9b51b75
chore: update README to v0.6.0 (#606)
chinaux Jul 20, 2026
fea2481
fix: HnswExternalStreamerEntity (#607)
iaojnh Jul 20, 2026
7647544
docs: modify wechat qp code link in readme (#610)
Cuiyus Jul 21, 2026
76711b5
Merge branch 'main' into feat/diskann_on_arm_new
iaojnh Jul 23, 2026
6e3872e
Merge branch 'main' into feat/diskann_on_arm_new
iaojnh Jul 23, 2026
a0d451b
fix
iaojnh Jul 23, 2026
15d864d
add ut
iaojnh Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/03-macos-linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ jobs:
cd "$GITHUB_WORKSPACE"
python -m pytest python/tests/test_collection_diskann.py -v
shell: bash

# Verify installing libaio does not affect existing non-DiskAnn tests.
- name: Run HNSW Tests (w/ libaio)
if: matrix.platform == 'linux-x64'
Expand Down
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,17 @@ else()
endif()
message(STATUS "RABITQ_ARCH_FLAG: ${RABITQ_ARCH_FLAG}")

# DiskAnn support (Linux x86_64 only; libaio loaded at runtime via dlopen)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386" AND NOT ANDROID AND NOT IOS)
# DiskAnn support:
# - Linux (x86_64, i686, i386, aarch64, arm64) with libaio (loaded via dlopen)
# - macOS (x86_64, ARM64/Apple Silicon) with kqueue
if((CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386|aarch64|arm64" AND NOT ANDROID AND NOT IOS)
OR (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT IOS))
set(DISKANN_SUPPORTED ON)
add_definitions(-DDISKANN_SUPPORTED=1)
else()
set(DISKANN_SUPPORTED OFF)
add_definitions(-DDISKANN_SUPPORTED=0)
message(STATUS "DiskAnn support disabled - only supported on Linux x86_64")
message(STATUS "DiskAnn support disabled - supported on Linux (x86_64/ARM64 with libaio) and macOS (with kqueue)")
endif()
message(STATUS "DISKANN_SUPPORTED: ${DISKANN_SUPPORTED}")

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
**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.

> [!Important]
> 🚀 **v0.5.0 (June 12, 2026)**
> 🚀 **v0.6.0 (July 20, 2026)**
>
> - **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.
> - **Hybrid Retrieval**: Combine full-text, dense-vector, and sparse-vector retrieval in a single query call, with scalar filtering and reranking.
> - **DiskANN Index**: New on-disk index that keeps the bulk of the index on disk, drastically cutting memory usage for large-scale datasets.
> - **Ecosystem & Platforms**: New official [Go](https://github.com/zvec-ai/zvec-go) / [Rust](https://github.com/zvec-ai/zvec-rust) SDKs, the [Zvec Studio](https://github.com/zvec-ai/zvec-studio) visual tool, and RISC-V support.
> - **Group-By Search**: Retrieve top-K results per group instead of globally (group-by deduplication) across Flat, HNSW, HNSW-RaBitQ, and sparse indexes.
> - **Random Rotation Quantization**: Optional random rotation for INT8/INT4 quantization distributes variance evenly across dimensions, significantly boosting recall.
> - **Enhanced Full-Text Search**: Upgraded FTS pipeline with a Unicode UAX #29 standard tokenizer, UTF-8 / ASCII folding, and a Snowball-based stemmer supporting 34+ languages.
> - **Faster & More Robust**: Block-max skip speeds up FTS conjunction queries by 22–38%, plus a new DiskANN C API and numerous stability fixes.
>
> 👉 [Read the Release Notes](https://github.com/alibaba/zvec/releases/tag/v0.5.0) | [View Roadmap 📍](https://github.com/alibaba/zvec/issues/309)
> 👉 [Read the Release Notes](https://github.com/alibaba/zvec/releases/tag/v0.6.0) | [View Roadmap 📍](https://github.com/alibaba/zvec/issues/309)

## 💫 Features

Expand All @@ -62,7 +62,7 @@ Zvec offers official SDKs across multiple languages:
- **[Python](https://pypi.org/project/zvec/)**: `pip install zvec` (requires 64-bit Python 3.10–3.14)
- **[Node.js](https://www.npmjs.com/package/@zvec/zvec)**: `npm install @zvec/zvec`
- **[Go](https://github.com/zvec-ai/zvec-go)**: High-performance Go bindings.
- **[Rust](https://github.com/zvec-ai/zvec-rust)**: High-performance Rust bindings.
- **[Rust](https://crates.io/crates/zvec-rust)**: `cargo add zvec-rust`
- **[Dart/Flutter](https://pub.dev/packages/zvec)**: `flutter pub add zvec`

Prefer a visual tool? Try **[Zvec Studio](https://github.com/zvec-ai/zvec-studio)** to browse data and debug queries — no code required.
Expand Down Expand Up @@ -123,7 +123,7 @@ For detailed benchmark methodology, configurations, and complete results, please

| 💬 DingTalk | 📱 WeChat | 🎮 Discord | X (Twitter) |
| :---: | :---: | :---: | :---: |
| <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="DingTalk QR Code"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png" width="150" alt="WeChat QR Code"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](<https://x.com/ZvecAI>) |
| <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="DingTalk QR Code"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png?v1" width="150" alt="WeChat QR Code"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](<https://x.com/ZvecAI>) |
| Scan to join | Scan to join | Click to join | Click to follow |

</div>
Expand Down
16 changes: 8 additions & 8 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
**Zvec** 是一款开源的嵌入式(进程内)向量数据库 — 轻量、极速,可直接嵌入应用程序。以极简的配置提供生产级、低延迟、可扩展的向量检索能力。

> [!IMPORTANT]
> 🚀 **v0.5.0(2026 年 612 日)**
> 🚀 **v0.6.0(2026 年 720 日)**
>
> - **全文检索(FTS)**:原生全文检索能力——可为任意字符串字段挂载 FTS 索引,使用自然语言或结构化表达式检索,无需外接搜索引擎
> - **混合检索**:在单次查询调用中融合全文、稠密向量和稀疏向量检索,并支持标量过滤与重排
> - **DiskANN 索引**:全新磁盘索引,将索引主体存于磁盘,大幅降低大规模数据集的内存占用
> - **生态与平台**:全新官方 [Go](https://github.com/zvec-ai/zvec-go) / [Rust](https://github.com/zvec-ai/zvec-rust) SDK、可视化工具 [Zvec Studio](https://github.com/zvec-ai/zvec-studio),以及 RISC-V 架构支持
> - **分组检索(Group-By)**:支持按分组去重检索,返回每个分组的 Top-K 结果而非全局 Top-K,覆盖 Flat、HNSW、HNSW-RaBitQ 与稀疏索引
> - **随机旋转量化**:为 INT8/INT4 量化新增可选的随机旋转能力,将方差均匀分布到各维度,显著提升召回率
> - **全文检索增强**:升级 FTS 文本分析管线,新增基于 Unicode UAX #29 的标准分词器、UTF-8 / ASCII 折叠,以及基于 Snowball、支持 34+ 种语言的词干提取过滤器
> - **更快更稳健**:Block-max 跳跃优化使 FTS 合取查询提速 22–38%,同时新增 DiskANN C API,以及大量稳定性修复
>
> 👉 [查看更新日志](https://github.com/alibaba/zvec/releases/tag/v0.5.0) | [查看路线图 📍](https://github.com/alibaba/zvec/issues/309)
> 👉 [查看更新日志](https://github.com/alibaba/zvec/releases/tag/v0.6.0) | [查看路线图 📍](https://github.com/alibaba/zvec/issues/309)

## 💫 核心特性

Expand All @@ -62,7 +62,7 @@ Zvec 提供多语言官方 SDK:
- **[Python](https://pypi.org/project/zvec/)**:`pip install zvec`(需 64 位 Python 3.10–3.14)
- **[Node.js](https://www.npmjs.com/package/@zvec/zvec)**:`npm install @zvec/zvec`
- **[Go](https://github.com/zvec-ai/zvec-go)**:高性能的 Go 绑定。
- **[Rust](https://github.com/zvec-ai/zvec-rust)**:高性能的 Rust 绑定。
- **[Rust](https://crates.io/crates/zvec-rust)**:`cargo add zvec-rust`
- **[Dart/Flutter](https://pub.dev/packages/zvec)**:`flutter pub add zvec`

想要图形界面?试试 **[Zvec Studio](https://github.com/zvec-ai/zvec-studio)**,零代码浏览数据与调试查询。
Expand Down Expand Up @@ -121,7 +121,7 @@ Zvec 提供极致的速度和效率,能够轻松应对高要求的生产环境

| 💬 钉钉群 | 📱 微信群 | 🎮 Discord | X (Twitter) |
| :---: | :---: | :---: | :---: |
| <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="钉钉二维码"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png" width="150" alt="微信二维码"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](<https://x.com/ZvecAI>) |
| <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/dingding.png" width="150" alt="钉钉二维码"/> | <img src="https://zvec.oss-cn-hongkong.aliyuncs.com/qrcode/wechat.png?v1" width="150" alt="微信二维码"/> | [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/rKddFBBu9z) | [![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/ZvecAI)](<https://x.com/ZvecAI>) |
| 扫码加入 | 扫码加入 | 点击加入 | 点击关注 |

</div>
Expand Down
1 change: 1 addition & 0 deletions examples/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ endif()
get_filename_component(ZVEC_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)

set(ZVEC_INCLUDE_DIR ${ZVEC_ROOT_DIR}/src/include)
set(ZVEC_SRC_DIR ${ZVEC_ROOT_DIR}/src)
set(ZVEC_LIB_DIR ${ZVEC_ROOT_DIR}/${HOST_BUILD_DIR}/lib)

include_directories(${ZVEC_INCLUDE_DIR})
Expand Down
13 changes: 5 additions & 8 deletions python/tests/detail/fixture_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
import logging
import platform

DISKANN_SUPPORTED = platform.system() == "Linux" and platform.machine() in (
"x86_64",
"AMD64",
"i686",
"i386",
)
DISKANN_SUPPORTED = (
platform.system() == "Linux"
and platform.machine() in ("x86_64", "AMD64", "i686", "i386", "aarch64", "arm64")
) or platform.system() == "Darwin"

from typing import Any, Generator
from zvec.typing import DataType, StatusCode, MetricType, QuantizeType
Expand All @@ -27,9 +25,8 @@ def _ensure_diskann_runtime_or_reason() -> str | None:
_DISKANN_PRELOAD_DONE = True

if not DISKANN_SUPPORTED:
_DISKANN_PRELOAD_REASON = "DiskAnn only supported on Linux x86_64"
_DISKANN_PRELOAD_REASON = "DiskAnn is supported on Linux (x86_64/ARM64 with libaio) and macOS (kqueue)"
return _DISKANN_PRELOAD_REASON

_DISKANN_PRELOAD_REASON = None
return None

Expand Down
14 changes: 10 additions & 4 deletions python/tests/test_collection_diskann.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

Two platform-level prerequisites are enforced at module import time:

1. DiskAnn is currently built only for Linux x86_64 — other platforms are
skipped wholesale.
1. DiskAnn is built for Linux (x86_64/ARM64 with libaio) and macOS (with kqueue) —
other platforms are skipped wholesale.
2. libaio is loaded eagerly (via dlopen) inside DiskAnnBuilder::init() /
DiskAnnStreamer::init(). If libaio is missing, DiskAnn falls back to
synchronous pread() — the tests still run but with degraded performance.
Expand All @@ -39,8 +39,14 @@
# Platform gating (must happen BEFORE we touch zvec).
# --------------------------------------------------------------------------- #
pytestmark = pytest.mark.skipif(
not (sys.platform == "linux" and platform.machine() in ("x86_64", "AMD64")),
reason="DiskAnn plugin is only supported on Linux x86_64",
not (
(
sys.platform == "linux"
and platform.machine() in ("x86_64", "AMD64", "aarch64", "arm64")
)
or sys.platform == "darwin"
),
reason="DiskAnn is supported on Linux (x86_64/ARM64 with libaio) and macOS (kqueue)",
)

import zvec # noqa: E402
Expand Down
2 changes: 1 addition & 1 deletion src/binding/python/model/common/python_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@ void ZVecPyConfig::Initialize(pybind11::module_ &m) {
}


} // namespace zvec
} // namespace zvec
11 changes: 10 additions & 1 deletion src/binding/python/model/python_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,16 @@ void ZVecPyCollection::bind_dql_methods(
"given vector column. One of 'mmap', 'buffer_pool', 'contiguous'. "
"Raises KeyError if no HNSW index exists on the column, or "
"ValueError if the column's index is not an HNSW index. Intended "
"for introspection and testing only; not part of the stable API.");
"for introspection and testing only; not part of the stable API.")
.def(
"_debug_io_backend_type",
[](const Collection &self) {
const auto result = self.DebugGetIoBackendType();
return unwrap_expected(result);
},
"Debug-only: returns the I/O backend type used by DiskAnn. "
"One of 'libaio', 'pread'. Intended for introspection and "
"testing only; not part of the stable API.");
}

} // namespace zvec
2 changes: 1 addition & 1 deletion src/core/algorithm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ else()
# Empty stub library for unsupported platforms
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/diskann_stub.cc
"// Stub implementation for unsupported platforms\n"
"// DiskAnn only supports Linux x86_64\n"
"// DiskAnn supports Linux (x86_64/ARM64 with libaio) and macOS (kqueue)\n"
"namespace zvec { namespace core { /* empty namespace for compatibility */ } }\n"
)

Expand Down
4 changes: 2 additions & 2 deletions src/core/algorithm/diskann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ file(GLOB_RECURSE ALL_SRCS *.cc *.c)
# ${CMAKE_DL_LIBS} for dlopen/dlsym/dlclose.
set(CORE_KNN_DISKANN_LIBS core_framework core_knn_cluster)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|i686|i386|aarch64|arm64")
list(APPEND CORE_KNN_DISKANN_LIBS ${CMAKE_DL_LIBS})
endif()

Expand All @@ -31,4 +31,4 @@ cc_library(
INCS . ${PROJECT_ROOT_DIR}/src/core ${PROJECT_ROOT_DIR}/src/core/algorithm
LDFLAGS "${CORE_KNN_DISKANN_LDFLAGS}"
VERSION "${PROXIMA_ZVEC_VERSION}"
)
)
8 changes: 7 additions & 1 deletion src/core/algorithm/diskann/diskann_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,13 @@ class DiskAnnContext : public IndexContext,
uint32_t group_num_{0};
std::map<std::string, TopkHeap> group_topk_heaps_{};

IOContext io_ctx_{0};
IOContext io_ctx_{
#if defined(__APPLE__) || defined(__MACH__)
-1
#else
0
#endif
};
SearchStats query_stats_;

float *pq_table_dist_buffer_{nullptr};
Expand Down
20 changes: 0 additions & 20 deletions src/core/algorithm/diskann/diskann_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@ struct DiskAnnMetaHeader {
clear();
}

DiskAnnMetaHeader(const DiskAnnMetaHeader &header) {
memcpy(this, &header, sizeof(header));
}

DiskAnnMetaHeader &operator=(const DiskAnnMetaHeader &header) {
if (this != &header) {
memcpy(this, &header, sizeof(header));
}
return *this;
}

void reset() {
doc_cnt = 0U;
}
Expand All @@ -104,15 +93,6 @@ struct DiskAnnPqMeta {
clear();
}

DiskAnnPqMeta(const DiskAnnPqMeta &meta) {
memcpy(this, &meta, sizeof(meta));
}

DiskAnnPqMeta &operator=(const DiskAnnPqMeta &meta) {
memcpy(this, &meta, sizeof(meta));
return *this;
}

void clear() {
memset(this, 0, sizeof(DiskAnnPqMeta));
}
Expand Down
Loading
Loading