EHI: End-to-end learning of Hierarchical Index for Efficient Dense Retrieval

Ramnath Kumar, Anshul Mittal, Nilesh Gupta, Aditya Kusupati, Inderjit S Dhillon, Prateek Jain · Submission to ICLR 2024 · Rejected

Abstract

Modern dense retrieval systems typically rely on a two-stage process: first generating document embeddings and then building an Approximate Nearest Neighbor Search (ANNS) index. This separation often leads to a "misalignment" where embeddings are not optimized for the specific partitioning logic of the index. We present EHI (End-to-end Hierarchical Indexing), a framework that jointly optimizes document embeddings and the search index structure. By making the hierarchical index differentiable, EHI ensures that the data representation and the search structure are perfectly aligned. Our results on benchmarks like MS MARCO show that EHI significantly outperforms traditional methods, achieving up to an 80% reduction in search latency without sacrificing accuracy.

Addressing the Embedding-Index Misalignment

In standard dense retrieval, a deep learning model (e.g., BERT) is trained to map queries and documents into a vector space. Subsequently, an external index—such as a tree or graph—is constructed to organize these vectors. A fundamental flaw in this approach is Embedding-ANNS Misalignment: the encoder is trained without knowledge of how the index will eventually cluster the data. Consequently, the resulting embeddings may be difficult for the index to partition efficiently.

Figure 1: Comparison between standard learned embedding structures and EHI's aligned representations.

Furthermore, traditional indexes are often query-agnostic, organizing data based solely on document similarity rather than the actual distribution of user queries. EHI solves this by training the embeddings and the index simultaneously, allowing the index to become "query-aware."

The EHI Framework

The core innovation of EHI is the transformation of a discrete, hierarchical tree structure into a differentiable component that can be trained via backpropagation.

Figure 6: Architectural comparison between traditional DE+ANNS, Generative Retrieval, and the proposed EHI framework.

Key Components:

  1. Dual Encoder: EHI utilizes a 6-layer DistilBERT architecture to generate initial embeddings for queries and documents.
  2. Hierarchical Indexer: Instead of a static flat index, EHI learns a tree-style structure where each node acts as a classifier, directing documents and queries down specific branches.
  3. Dense Path Embeddings: To enable end-to-end training, EHI represents the path an item takes through the tree as a vector. Items ending in the same leaf node share similar path embeddings.
  4. Joint Optimization: The model is trained using a multi-faceted loss function that balances semantic similarity (relevance), indexing similarity (path alignment), and intra-leaf similarity (fine-grained ranking).

Experimental Results

EHI was evaluated on several major information retrieval benchmarks, including MS MARCO, TREC DL19, and Natural Questions (NQ320k).

  • Accuracy Gains: On MS MARCO, EHI achieved a +1.45% improvement in MRR@10 over state-of-the-art baselines. On TREC DL19, it demonstrated a significant +8.2% jump in nDCG@10.
  • Efficiency: EHI can match the accuracy of exhaustive exact search while visiting only 20% of the document corpus, translating to an 80% reduction in search latency.
  • Scalability and Robustness: The system scales effectively to deeper tree structures required for industrial-sized datasets and maintains stable performance across different random initializations.

Conclusion

EHI represents a paradigm shift in dense retrieval by bridging the gap between representation learning and index construction. By treating the index as a learnable, differentiable component, EHI eliminates the inefficiencies of misaligned embeddings and produces a search structure that is inherently optimized for the query distribution. Future work will explore scaling EHI to billions of documents and integrating it with more complex late-interaction models.

Summary updated

BibTeX
@misc{kumar2023ehi,
  author = {Ramnath Kumar and Anshul Mittal and Nilesh Gupta and Aditya Kusupati and Inderjit S Dhillon and Prateek Jain},
  title = {{EHI: End-to-end learning of Hierarchical Index for Efficient Dense Retrieval}},
  year = {2023},
  eprint = {2310.08891},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.08891},
}
Figure