Analyzing Adversarial Attacks on Sequence-to-Sequence Relevance Models

Andrew Parry, Maik Fröbe, Sean MacAvaney, Martin Potthast, Matthias HagenarXiv 2024

TL;DR

Modern neural search models, specifically sequence-to-sequence (seq2seq) models like monoT5, are highly vulnerable to "prompt injection" attacks. By simply injecting relevance-indicating tokens like "true" or "relevant" into a document, malicious actors can significantly boost its search ranking without needing access to the model's internal weights or specific user queries.

What Problem Does This Paper Address?

Search Engine Optimization (SEO) has traditionally targeted lexical models (like BM25) using techniques like keyword stuffing. As the field shifts toward neural relevance models based on Large Language Models (LLMs), there is a common assumption that these "smarter" models are more robust to simple manipulation.

However, many state-of-the-art re-rankers, such as monoT5, operate by framing relevance as a seq2seq task. They take a prompt like Query: [q] Document: [d] Relevant: and are trained to predict the next token as either true or false. The authors investigate whether this specific prompt structure creates a new vulnerability: can a document "inject" its own relevance labels into the input stream to trick the model into outputting true?

Methods

The authors propose and evaluate three types of query-independent adversarial attacks:

  1. Adversarial Preemption: Prepending or appending strings that mimic the model's own control tokens (e.g., adding "Relevant: true" to the document text).
  2. Keyword Stuffing: Repeating the target output token (e.g., "true true true") at various positions within the document.
  3. LLM Re-writing: Using LLMs (Alpaca and ChatGPT) to either paraphrase the document or generate a summary that naturally incorporates adversarial tokens.

Unlike previous adversarial research, these attacks are query-independent (the same document modification works for any query) and black-box (they require no knowledge of model weights).

Table 2: Overview of requirements of different adversarial attacks on neural relevance models. Attackers either need full (✓), partial (✓*), or no access (X).

As shown in the table above, the proposed attacks have the lowest requirements compared to existing literature, making them highly practical for real-world malicious actors.

Datasets

The study utilizes the following benchmarks:

  • TREC Deep Learning tracks (2019 and 2020): Used for evaluating passage ranking effectiveness.
  • MS MARCO (Version 1): A large-scale dataset containing 8.8 million passages.
  • Pilot Study: 1,000 query-document pairs from TREC 2019 were used to fine-tune the LLM-based rewriting prompts.

Key Insights and Ideas

  • The "Aha" Moment: The very mechanism that makes seq2seq models powerful—the ability to process natural language prompts—is their Achilles' heel. Because the document text and the prompt are processed in the same sequence, the model can't easily distinguish between the "official" prompt and "injected" instructions within the document.
  • Positional Sensitivity: monoT5 variants exhibit a strong "start-of-document" bias. Prepending adversarial tokens is far more effective than appending them.
  • Generalization: Surprisingly, these attacks also work on encoder-only models like Electra and bi-encoders like TAS-B, even though those models weren't trained with the specific "Relevant: true/false" prompt. This suggests a broader vulnerability in how neural models handle certain high-signal tokens.
  • Lexical Immunity: Traditional BM25 is completely unaffected by these specific attacks because "true" and "relevant" are rarely the keywords users are searching for.
Figure 1: Aggregate MRC over every 100 ranks for the token ’relevant’ injected 5 times at different positions.

Figure 1 illustrates the positional bias: injecting tokens at the Start (left) leads to a much higher Mean Rank Change (MRC) compared to Random or End positions, particularly for the monoT5-base and monoT5-large models.

Key Results

  • Rank Improvement: In the most effective scenarios, documents saw a mean rank improvement of over 63 places. For some smaller models, rank increased by up to 111 places.
  • Success Rate: The attacks were successful (improved the document's rank) in more than 78% of the tested cases for monoT5.
  • LLM Effectiveness: Attacks using the open-source Alpaca model for rewriting often outperformed those using ChatGPT, suggesting that even smaller, locally-run LLMs can be used to generate potent adversarial content at scale.
Table 1: Illustration of three prompt injection attacks on the monoT5 relevance model for the query q := How long do fleas live? to increase the predicted relevance of document d. Besides ‘true’, other adversarial terms can be used.

Limitations and Future Work

The authors acknowledge that their study focuses on passage re-ranking rather than full-corpus retrieval. While they demonstrate that these attacks can push a document from rank 100 to rank 1, it remains to be seen how they affect the initial retrieval stage (first-stage retrieval).

Future Directions: * Hardening Models: Developing training techniques or architectural changes to make neural rankers resistant to prompt injection. * Detection: Creating filters to identify documents that have been "stuffed" or rewritten with adversarial intent. * Impact on Data Labeling: Since LLMs are increasingly used to generate "silver standard" training data for other models, these attacks could potentially poison entire training pipelines if not addressed.

Summary updated

BibTeX
@misc{parry2024analyzing,
  author = {Andrew Parry and Maik Fröbe and Sean MacAvaney and Martin Potthast and Matthias Hagen},
  title = {{Analyzing Adversarial Attacks on Sequence-to-Sequence Relevance Models}},
  year = {2024},
  eprint = {2403.07654},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.07654},
}
Figure