提出可分级搜索的哈希编码,用32字节实现高效精准语义检索。
Matryoshka Hash Representations for Model-Aware Compact Semantic Retrieval

- 分两阶段训练:先学长二进制码,再加残差适配器生成可直接搜索的前缀。
- 在32字节下达到NDCG@10为0.5561,召回率@100达0.6535,优于现有方法。
- 适合需要多级存储效率的检索系统,尤其在低比特场景优势明显。
检索增强生成(RAG)依赖密集检索:文档被编码为学习到的向量,查询通过在向量空间中寻找最近邻来回答。在语料库规模下,每个文档保持全精度向量是主要索引开销,因此检索系统将每个向量替换为几字节的短码(即量化)。标准量化器如乘积量化(PQ)选择能最精确重构原向量的码。若单个码能支持多个字节预算的直接搜索,则部署时无需重新编码即可调整效率-质量平衡。但统一目标训练所有前缀会导致早期位在不同预算间妥协——短码改善而全宽码退化。低比特表示(如二进制码)使这一冲突更尖锐。本文提出马特里什卡哈希表示(MHR),一种两阶段流程:先学习较长二进制码,再冻结模型,对每个前缀训练零初始化残差适配器以实现直接搜索。文档存储为每坐标1比特,查询保留连续逻辑值以维持表达力。使用FAISS FastScan实现搜索。在MS MARCO上训练,零样本迁移至7个BEIR数据集,32字节下达到NDCG@10为0.5561,Recall@100为0.6535,超越同预算最佳基线。在更低预算下优势更显著。该编码还增强两类常用流水线:用于全精度重排序的候选筛选,以及低存储图索引(如LEANN)的剪枝。
原文摘要 · Abstract (English)
Retrieval-augmented generation (RAG) depends on dense retrieval: each document is stored as a learned vector, and a query is answered by finding its nearest neighbors in that vector space. Keeping one full-precision vector per document is the dominant index cost at corpus scale, so retrieval systems replace each vector with a short code of a few bytes---a step called quantization. Standard quantizers such as product quantization (PQ) pick the code that reconstructs the original vector most closely. A single code is even more useful if it serves several byte budgets at once: when its short prefixes are each directly searchable, a deployment can set its efficiency--quality operating point without re-encoding the corpus. But training all prefixes under one objective makes the early bits a compromise across budgets---short codes improve while the full-width code degrades. Quantization to low-bit representation, such as binary codes, further sharpens the conflict. We introduce Matryoshka Hash Representations (MHR), a two-stage procedure that separates full-width training from prefix organization. MHR first learns a longer binary code, then freezes the model and trains additional zero-initialized residual code adaptors for directly searchable prefixes. Documents are stored at one bit per coordinate, while queries keep continuous logits like PQ to attain sufficient expressivity. We implement the search process with FAISS FastScan. Trained on MS MARCO and zero-shot transferred to seven BEIR datasets, MHR reaches .5561 NDCG@10 and .6535 Recall@100 at 32 bytes, surpassing the best baseline of the same budget. The advantage is more pronounced in lower budgets. The same code also strengthens two common pipelines: shortlisting candidates for full-precision reranking, and pruning a low-storage graph index such as LEANN.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。