Reproducing HotFlip for Corpus Poisoning Attacks in Dense Retrieval

Yongkang Li, Panagiotis Eustratiadis, Evangelos Kanoulas

Abstract

Dense retrieval (DR) systems, which utilize neural bi-encoders to map queries and documents into a shared vector space, are increasingly central to modern information retrieval. However, these systems are susceptible to corpus poisoning attacks, where an adversary injects malicious passages to manipulate search rankings. This paper reproduces and optimizes the state-of-the-art HotFlip attack. By introducing a pipeline optimization strategy using query centroids, the authors achieved a 16x speedup in adversarial passage generation. Despite high success in white-box settings, the study reveals significant "brittleness" in black-box scenarios, where attacks fail to transfer across different model architectures.

Introduction: The Vulnerability of Dense Retrieval

Modern search and recommendation engines rely on Dense Retrieval (DR) to identify relevant content. These systems encode queries and documents into high-dimensional vectors; relevance is determined by the proximity of these vectors in the embedding space. While effective, this architecture introduces a security risk known as Corpus Poisoning.

In a corpus poisoning attack, an adversary inserts a small number of carefully crafted "adversarial passages" into a large database (e.g., Wikipedia). These passages are designed to appear at the top of the ranking list for specific target queries, enabling the spread of misinformation or unauthorized promotion. The current benchmark for such attacks is HotFlip, a gradient-based method that iteratively modifies tokens to maximize similarity to a target query.

Overview of the corpus poisoning process and the iterative HotFlip token substitution mechanism.

Methodology: Optimizing the HotFlip Pipeline

The primary challenge with the original HotFlip implementation is its computational intensity. Generating a single short adversarial passage can take hours of GPU time because the method calculates gradients for every query-passage pair in a batch.

Query Centroid Optimization

To address this efficiency bottleneck, the researchers introduced a Pipeline Optimization Strategy. Instead of optimizing against every individual query in a target set, they calculated the mean embedding (centroid) of the query cluster. By optimizing the adversarial passage to match this single "average" vector, they eliminated redundant calculations without sacrificing attack efficacy.

Experimental Setup

The study evaluated the optimized attack across four major Information Retrieval (IR) benchmarks: Natural Questions (NQ), MS MARCO, and two datasets from the BEIR benchmark (ArguAna and FiQA). The researchers tested the method in three scenarios:

  1. White-Box: The attacker has full knowledge of the target model.
  2. Black-Box: The attack is generated on one model and tested on another.
  3. Query-Agnostic: The attacker targets the "average" document in the corpus without knowing specific user queries.

Key Results: Speed and Success

The optimization strategy yielded dramatic improvements in performance. On an NVIDIA L40 GPU, the time required to generate a single adversarial document dropped from approximately 4 hours to just 15 minutes.

Comparison of time costs between the reproduced baseline and the optimized "Ours" method across different models and datasets.

In white-box settings, the attack was devastatingly effective. Against the Contriever model, the success rate reached 99.4%, meaning the malicious passage appeared in the top 20 results for nearly every target query. However, the study also uncovered a critical limitation: adversarial brittleness. Attacks optimized for one model (e.g., Contriever) frequently had a 0.0% success rate when tested against a different model (e.g., DPR). This suggests that adversarial passages are hyper-tuned to the specific geometric nuances of a single model's vector space.

Discussion and Defensive Insights

The research provides several key insights for the development of more robust retrieval systems:

  • Vector Norms as a Signal: Adversarial passages often exhibit significantly higher L2 norms (vector lengths) than natural text. Monitoring for unusually long vectors could serve as an effective, low-cost defense mechanism.
  • Volume in Query-Agnostic Attacks: When the attacker lacks specific query knowledge, the success of the attack depends on the volume of injected passages. Even poisoning 0.01% of a corpus can measurably degrade performance.
  • Model Robustness: Advanced architectures like Dragon+ showed greater inherent resistance to these gradient-based attacks compared to older models.

Conclusion

While the optimized HotFlip attack demonstrates that corpus poisoning can be executed with high efficiency, its lack of transferability limits its practical threat in black-box environments. Future research should leverage these high-speed generation techniques to create adversarial training data, further hardening dense retrieval models against such vulnerabilities.

Summary updated

BibTeX
@inproceedings{li2025reproducing,
  author = {Yongkang Li and Panagiotis Eustratiadis and Evangelos Kanoulas},
  title = {{Reproducing HotFlip for Corpus Poisoning Attacks in Dense Retrieval}},
  booktitle = {ECIR},
  year = {2025},
  doi = {10.1007/978-3-031-88717-8\_8},
}
Figure