On the adversarial robustness of Locality-Sensitive Hashing in Hamming space

Michael Kapralov, Mikhail Makarov, Christian Sohler

Introduction

Locality-Sensitive Hashing (LSH) is a fundamental technique for Approximate Nearest Neighbor (ANN) search in high-dimensional spaces. By mapping similar items into the same buckets with high probability, LSH achieves sublinear search times. However, traditional security guarantees for LSH assume an oblivious adversary who selects queries without observing the results. This paper explores the vulnerability of LSH to adaptive adversaries who use feedback from previous queries to find "blind spots"—queries that are close to a data point but are not returned by the LSH structure.

Algorithm 1: The standard LSH query procedure targeted by the adversary.

Methodology: The Adversarial Walk

The authors propose an Adversarial Walk to leak information about the internal hash functions of an LSH instance. The attack starts with a query $q$ very close to a target point $z$ in the dataset. Since $q$ and $z$ are close, LSH is likely to return $z$. The adversary then iteratively modifies $q$ (e.g., by flipping bits in Hamming space) to move it further away while checking if LSH still returns $z$.

By identifying the exact point where LSH stops returning $z$, the adversary uncovers "critical bits" that determine the hash bucket boundaries. A refined version, the Fast Adversarial Walk, utilizes binary search to find these boundaries exponentially faster than random sampling. While a random search requires $O(1/\delta)$ queries to find a failure (where $\delta$ is the failure probability), the adaptive walk requires only $O(\log(1/\delta))$ queries.

Experimental Evaluation

The attack was evaluated on synthetic datasets (Random, Sparse Random, Zero) and real-world datasets including MNIST (handwritten digits), MSWeb (web visitor data), and Mushroom (categorical features).

Key Results

The experiments demonstrate that the adaptive attack is highly effective across diverse data distributions. As shown in the success probability plots, the adversary consistently finds queries at distance $r$ that the LSH structure fails to retrieve, even in complex real-world datasets like MNIST and Mushroom.

Success probability of the adversarial attack across various synthetic and real-world datasets.

The attack's efficiency is most pronounced as the security parameter $\lambda$ increases. In the "Random" dataset, the speedup over random sampling reached several orders of magnitude. The vulnerability is particularly acute for "isolated points"—data points far from others—where the adversarial signal is clearest.

Conclusion and Future Work

This research highlights a significant security gap in standard LSH implementations. While some defenses like differential privacy offer partial protection, they often impose heavy performance penalties. Future work includes extending these attacks to Euclidean and Cosine similarity spaces and developing new, robust LSH variants that can withstand adaptive querying without sacrificing efficiency.

Summary updated

BibTeX
@article{kapralov2025adversarial,
  author = {Michael Kapralov and Mikhail Makarov and Christian Sohler},
  title = {{On the adversarial robustness of Locality-Sensitive Hashing in Hamming space}},
  journal = {Proc. ACM Manag. Data},
  year = {2025},
  doi = {10.1145/3725239},
}
Figure