无需训练的嵌入向量搜索内核,可离线运行于设备端。
MonaVec: A Training-Free Embedded Vector Search Kernel for Edge and Offline AI Systems

- 基于随机哈达玛变换实现免训练量化,输入分布无关
- 4比特压缩下召回率0.960,仅需27MB内存,支持重复结果
- 纯Rust实现,兼容多架构,适合离线检索场景
我们提出MonaVec,一种面向边缘和离线AI的确定性嵌入向量搜索内核。现有系统依赖服务器、大量内存或训练数据,而MonaVec借鉴SQLite设计:一个文件、一次函数调用,随处运行。其量化核心默认无需训练且数据无关:随机哈达玛变换(RHDH)将任意输入分布映射至N(0,1),使预计算的Lloyd-Max表可实现4比特量化(比原尺寸小8倍),无需学习码本也无需数据遍历。索引以单个.mvec文件持久化,嵌入的ChaCha20旋转种子确保跨架构可复现,同一构建下结果字节完全一致——这是并行构建图库无法保证的确定性。在语义嵌入(AG News,45K × 1024维BGE-M3,余弦相似度)上,MonaVec 4比特暴力搜索在27MB内存下达到0.960 Recall@10,优于浮点FAISS-IVF与8比特usearch;虽峰值吞吐较低,但获得字节一致的确定性。单次全局标准化(fit())扩展该管道至对幅度敏感的L2数据,可选IvFFlat与HNSW后端支持百万向量语料库。MonaVec由纯Rust实现,含Python绑定与运行时SIMD调度(AVX-512/AVX2/NEON/标量),面向设备端RAG、离线代理与嵌入式检索,填补了关系型数据领域中SQLite所占的空白:一文件、一调用、处处运行。
原文摘要 · Abstract (English)
We present MonaVec, a deterministic, embedded vector-search kernel for edge and offline AI -- settings where server infrastructure, network connectivity, and training data are all unavailable. Existing vector-search systems assume a persistent server, gigabytes of RAM, or a training pass over the corpus; MonaVec instead targets the deployment profile of SQLite: one file, one function call, runs anywhere. Its quantization core is training-free by default and data-oblivious: a Randomized Hadamard Transform (RHDH) conditions any input distribution toward N(0,1), so precomputed Lloyd-Max tables quantize to 4 bits (8x smaller) with no learned codebook and no data pass. The index persists as a single .mvec file whose embedded ChaCha20 rotation seed makes results reproducible across architectures and byte-identical within a build -- a determinism guarantee that parallel-build graph libraries cannot offer. On semantic embeddings (AG News, 45K x 1024-dim BGE-M3, cosine), MonaVec 4-bit BruteForce reaches 0.960 Recall@10 in 27 MB -- leading float32 FAISS-IVF and 8-bit usearch on recall -- while trading peak throughput for byte-identical determinism. A single-pass global standardization (fit()) extends the same data-oblivious pipeline to magnitude-sensitive L2 data, and optional IvfFlat and HNSW backends carry it to million-vector corpora. MonaVec is implemented in pure Rust with Python bindings and runtime SIMD dispatch (AVX-512/AVX2/NEON/scalar). It targets on-device RAG, offline agents, and embedded retrieval -- the niche SQLite occupies for relational data: one file, one call, runs anywhere.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。