SOCKET: SOft Collison Kernel EsTimator for Sparse Attention
Sahil Joshi, Agniva Chowdhury, Wyatt Bellinger, Amar Kanakamedala, Ekam Singh, Hoang Anh Duy Le, Aditya Desai, Anshumali Shrivastava
TL;DR
SOCKET tackles the heavy cost of dense attention in long-context inference by introducing a soft Locality-Sensitive Hashing (LSH)–based scoring kernel that treats collisions as probabilistic, similarity-aware signals rather than binary matches. By transforming LSH into a ranker, SOCKET enables stable top-$k$ token selection without data-dependent training, delivering principled angular-attention–style behavior with theoretical guarantees and practical speedups. The approach is backed by a sampling-based estimator and a tight end-to-end error bound that decomposes sources of approximation error into sampling variance, finite-table effects, and a bias term controlled by the temperature $\tau$. Empirically, SOCKET shows strong accuracy across LongBench and RULER benchmarks on multiple models and achieves up to $1.5\times$ decode-throughput improvements over FlashAttention, with robust, data-agnostic performance that reduces reliance on retraining or calibration. The work provides a concrete, open-source pathway for efficient long-context inference using soft-collision kernels.
Abstract
Exploiting sparsity during long-context inference is central to scaling large language models, as attention dominates the cost of autoregressive decoding. Sparse attention reduces this cost by restricting computation to a subset of tokens, but its effectiveness depends critically on efficient scoring and selection of relevant tokens at inference time. We revisit Locality-Sensitive Hashing (LSH) as a sparsification primitive and introduce SOCKET, a SOft Collision Kernel EsTimator that replaces hard bucket matches with probabilistic, similarity-aware aggregation. Our key insight is that hard LSH produces discrete collision signals and is therefore poorly suited for ranking. In contrast, soft LSH aggregates graded collision evidence across hash tables, preserving the stability of relative ordering among the true top-$k$ tokens. This transformation elevates LSH from a candidate-generation heuristic to a principled and mathematically grounded scoring kernel for sparse attention. Leveraging this property, SOCKET enables efficient token selection without ad-hoc voting mechanism, and matches or surpasses established sparse attention baselines across multiple long-context benchmarks using diverse set of models. With a custom CUDA kernel for scoring keys and a Flash Decode Triton backend for sparse attention, SOCKET achieves up to 1.5$\times$ higher throughput than FlashAttention, making it an effective tool for long-context inference. Code is open-sourced at https://github.com/amarka8/SOCKET.
