Peichun Hua

arXiv preprint · 2026

Matryoshka Hash Representations for Model-Aware Compact Semantic Retrieval

Peichun Hua, Yunming Xiao

Overview

Matryoshka Hash Representations (MHR) learns compact binary document codes for semantic search and retrieval-augmented generation. One stored code supports multiple directly searchable prefix lengths, allowing a system to adjust its storage–quality trade-off without re-encoding the corpus.

Method

MHR first trains a full-width, ranking-aware binary representation, then freezes that model and learns zero-initialized residual code adaptors for shorter prefixes. Documents use one bit per coordinate; queries retain continuous logits. A FAISS FastScan implementation supports efficient asymmetric scoring.

MHR pipeline showing full-width training, residual adaptors for shorter prefixes, and asymmetric scoring of continuous queries against binary documents.
One binary code, several search budgets. Full-width training is followed by frozen prefix adaptation and asymmetric search. Figure 1 in the paper

Evaluation

Trained on MS MARCO and evaluated by zero-shot transfer to seven BEIR datasets, MHR reports NDCG@10 of 0.5561 and Recall@100 of 0.6535 at 32 bytes per document, compared with 0.5239 and 0.6426 for the best evaluated same-budget baseline. The paper also evaluates candidate shortlisting and low-storage graph-index pruning.

Retrieval quality at compact document budgets
Method8 bytes16 bytes32 bytes
PQ0.045 / 0.1560.217 / 0.3950.429 / 0.593
OPQ0.090 / 0.2260.232 / 0.4230.430 / 0.597
JPQ-FT0.217 / 0.3420.404 / 0.5370.524 / 0.638
JPQ-Nested0.188 / 0.3240.355 / 0.5160.524 / 0.643
MHR0.376 / 0.5180.502 / 0.6160.556 / 0.653
Each cell is NDCG@10 / Recall@100, macro-averaged across seven BEIR datasets after source-only MS MARCO training. Selected baselines from Table 1. JPQ-FT at 8 and 16 bytes is literal truncation of its 32-byte model. The 3,072-byte float BGE reference achieves 0.637 / 0.720. Budgets count document payload, excluding shared metadata and index overhead. Table 1 in the paper

Citation

@misc{hua2026matryoshka,
      title={Matryoshka Hash Representations for Model-Aware Compact Semantic Retrieval}, 
      author={Peichun Hua and Yunming Xiao},
      year={2026},
      eprint={2609.07276},
      archivePrefix={arXiv},
      primaryClass={cs.IR},
      url={https://arxiv.org/abs/2609.07276}, 
}