H Hierarchical Hash Retrieval (HHR) is proposed, a coarse-to-fine framework that progressively improves retrieval accuracy through Geometry-Aware Key Routing and Learned Hash Projection, substantially improving the fidelity of hash-based sparse attention.
Abstract
Efficient long-context inference is essential for large language models (LLMs), yet it poses a severe computational bottleneck. Hash-based retrieval offers an efficient alternative by encoding queries and keys into binary codes and using Hamming distance for key selection. However, this leads to a critical mismatch between Hamming distance and attention relevance. Query-Key logits depend jointly on directional similarity and feature magnitudes, whereas hash binarization discards magnitude information, causing both false-positive retrieval of low-logit keys and false-negative omission of high-logit keys. To address these failures, we propose Hierarchical Hash Retrieval (HHR), a coarse-to-fine framework that progressively improves retrieval accuracy through Geometry-Aware Key Routing (GKR) and Learned Hash Projection (LHP). GKR learns a head-wise orthogonal transformation to redistribute feature magnitudes and derive more discriminative page-level logit bounds, enabling effective pruning of low-logit keys while preserving important candidates. LHP then learns a head-wise projection space that aligns Hamming distance with the true Query-Key relevance ranking for fine-grained retrieval. By combining GKR and LHP, HHR suppresses false positives and recovers false negatives, substantially improving the fidelity of hash-based sparse attention. Extensive experiments across diverse LLMs and benchmarks demonstrate that HHR achieves superior performance over existing methods. For example, on LongBench, HHR improves the average score by 1.10 points and, at a context length of 128K, achieves up to a 3.30x decoding speedup and a 2.83x end-to-end speedup for Llama-3.1-8B-Instruct. The code is publicly available at https://github.com/lianjunl13-sudo/HHR.
Large-scale image retrieval requires compact representations without substantially sacrificing retrieval accuracy. However, Vision Transformer Hashing (VTS) concatenates all output tokens before hash projection, resulting in a high-dimensional hashing head with considerable model and memory overhead. We replace this to...
U. Nguyen, Hoai Ba, Quynh Dao Thi Thuy· Discover Artificial Intellig...· 0 citations
Sparse attention reduces the KV-cache traffic that dominates long-context LLM decoding, but practical methods largely operate at coarse granularity. Token-level selection offers finer control, yet presents two challenges: low-dimensional scoring may lose query--key structure needed for accurate ranking, while gathering...
Autoregressive generation in Large Language Models (LLMs) is constrained by the memory and computational demands of attention mechanisms. Sparse attention methods mitigate this cost by selecting only high-probability entries of the attention matrix. We observe that in many such methods, this renders the probability-val...
Noam Elata, Itay Lamprecht, Mikey Shechter et al.· 0 citations
As large language models increasingly support long-context inference, the computation and memory access overhead of attention and KV caches have become critical bottlenecks for inference latency and system scalability. Existing approaches mitigate these costs through KV cache dropping, approximate attention, or system-...
Hao-Huan Feng, Shi-Yu Yang, Yuxuan Lu et al.· Proceedings of the 35th ACM...· 0 citations
The aim of Video Corpus Moment Retrieval (VCMR) is to locate temporal moments within a large video corpus on the basis of textual queries; however, it faces challenges in balancing retrieval efficiency and localization accuracy. Existing approaches typically rely on high-dimensional continuous embeddings for retrieval...
Ming-Jin Kuai, Jin-Zhuo Peng, Zhe-Qi Lv et al.· IEEE Transactions on Image P...· 0 citations