Hypencoder: Hypernetworks for Information Retrieval

Julian Killingback, Hansi Zeng, Hamed Zamani

Abstract

Standard neural information retrieval models face a strict trade-off between the speed of bi-encoders and the accuracy of cross-encoders. We introduce Hypencoder, a novel framework that treats queries as dynamic functions rather than static vectors. By using a hypernetwork to generate a query-specific scoring network ($q$-net) on the fly, Hypencoder achieves state-of-the-art accuracy on complex retrieval tasks while maintaining sub-60ms search latency through a custom graph-based search algorithm.

Introduction

In modern neural information retrieval (IR), the landscape is dominated by two paradigms: bi-encoders and cross-encoders. Bi-encoders are efficient, allowing for pre-computed document embeddings and fast inner-product similarity searches. However, they are limited by the linear nature of vector math. Cross-encoders offer deep, non-linear relevance matching but are computationally prohibitive for large-scale first-stage retrieval.

The authors mathematically demonstrate, using Radon's Theorem, that linear similarity functions like inner products are fundamentally incapable of perfectly separating relevant documents in complex vector spaces. Hypencoder addresses this by bridging the gap: it provides the complex matching of a cross-encoder with the efficiency of a bi-encoder.

Methods: Queries as Functions

The core innovation of Hypencoder is shifting the paradigm from "queries as vectors" to "queries as functions."

Comparison of retrieval architectures: Vector Similarity, Learned Similarity, Cross-encoding, and the proposed Hypencoder.

The Hypernetwork and $q$-net

Instead of pooling a query into a single vector, a BERT-based query encoder feeds contextualized tokens into an attention-based "hyper-head." This head generates the weights and biases for a small, dynamic feed-forward neural network called the $q$-net.

Documents are encoded into standard 768-dimensional dense vectors. Relevance is calculated by passing the document vector as input into the dynamically generated $q$-net, which outputs a scalar score. To maintain efficiency, the authors developed a custom graph-based greedy search algorithm. This algorithm navigates a pre-built "small-world" graph of document embeddings, using the $q$-net to evaluate neighbors without exhaustive scoring of the entire corpus.

Experimental Setup

The model was trained on the MSMARCO passage retrieval dataset (8.8M passages). Evaluation spanned several benchmarks:

  • In-Domain: MSMARCO Dev, TREC DL 2019/2020.
  • Zero-Shot (BEIR): TREC-COVID, FiQA, NFCorpus, and others.
  • Hard Tasks: TREC Tip-of-the-Tongue (TOT) 2023, FollowIR, and TREC DL-HARD.

Results and Discussion

Hypencoder achieved a record nDCG@10 of 0.736 on TREC DL '19 & '20, surpassing heavily optimized models and even 7B-parameter LLM-based retrievers like RepLLaMA. Its advantage is most pronounced in complex tasks like FollowIR, where it was the only model of its size to successfully adapt rankings based on multi-faceted instructions.

Performance (nDCG@10) and latency trade-offs across different search parameters including candidate set size and iteration count.

Efficiency

Despite the non-linear scoring, the graph-based search allows Hypencoder to retrieve from 8.8M documents in approximately 59.6 ms per query on an NVIDIA L40S GPU. This represents a viable path for deploying high-accuracy, non-linear models in production environments. Ablation studies suggest that a 4-to-6 layer $q$-net provides the optimal balance between performance and optimization stability.

Conclusion

Hypencoder demonstrates that hypernetworks can effectively overcome the mathematical bottlenecks of standard vector similarity in IR. While the current implementation uses single-vector document representations, future work could extend this framework to multi-vector models like ColBERT or incorporate advanced training techniques like hard negative mining to further enhance performance.

Summary updated

BibTeX
@inproceedings{killingback2025hypencoder,
  author = {Julian Killingback and Hansi Zeng and Hamed Zamani},
  title = {{Hypencoder: Hypernetworks for Information Retrieval}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2025},
}
Figure