Adversarial semantic collisionsAdversarial Semantic Collisions
The authors propose the semantic collision attack: a white-box gradient method generates text that is semantically unrelated to the input but judged as similar by the model, with successful attacks on four NLP tasks.
The attacker has full knowledge of the target model (white-box, including architecture and parameters) and can control part of the input (e.g., inserting or modifying candidate documents in a retrieval system); the goal is to generate a collision c that is semantically unrelated to the target input x but judged as similar by the model. Black-box transfer is left as future work.
- Tasks in which NLP models judge the semantic similarity of texts (paraphrase identification, document retrieval, response suggestion, extractive summarization) may be attacked by semantic collisions: semantically unrelated texts are judged as similar by the model, which the authors believe can lead to consequences such as incorrect deduplication merging and irrelevant documents rising in ranking.
- The authors propose a gradient-based semantic collision generation method: first optimize a soft collision via temperature-annealed continuous relaxation, then project it into a hard collision with beam search and iterate; there are also two LM-constrained variants, regularized aggressive and natural, to evade perplexity filtering.
- Attacking SOTA models on four tasks: on MRPC/QQP the aggressive collision success rate is about 97%, on Core17/18 49.9% of unrelated documents enter the top-10, on Chat the top-1 proportion exceeds 99%, and on CNNDM top-3 reaches 100%; constrained collisions can evade perplexity filtering.
- The authors note: black-box transfer, cross-pretrained-model transfer, evaluation of learning-based filtering, and adversarial training are all left as future work; the experiments cover only BERT/RoBERTa-type models and five datasets, and perplexity filtering performs poorly against constrained collisions.
- Evaluated models
- BERTRoBERTaBirchBi-encoderPoly-encoderPreSumm
- Benchmarks
- MRPCQQPCore17/18Persona-chatCNN/DailyMail
- Metrics
- similarity score S% Succrank (top-1/top-3/top-10/top-100)BERTScoreFP@90/FP@80
The paper proposes a "semantic collision" attack against NLP models, namely text that is semantically unrelated but judged by the model as similar to a target input, and presents a gradient-based generation method. Under the assumption that the attacker has white-box access to the target model and can control part of the input, state-of-the-art models in four task types—paraphrase identification, document retrieval, reply recommendation, and extractive summarization—were all shown to be vulnerable: on Quora Question Pairs, collisions were misjudged as paraphrases of the original input with an average confidence of 97%; in document retrieval, the median rank of irrelevant documents rose from 1000 to around 10; in reply recommendation, the aggressive and natural variants ranked first at rates of 99% and 86%, respectively; and in extractive summarization, collisions were selected as summary sentences 100% of the time. The authors also show how to generate natural collisions that bypass perplexity filtering, and discuss mitigations such as perplexity filtering, detection classifiers, and adversarial training, concluding that simple perplexity filtering is insufficient. Code is released at https://github.com/csong27/collision-bert。
Why it was selectedThe paper proposes collision attacks against semantic similarity models that can raise the retrieval ranking of irrelevant documents from 1000 into the top three, and simple perplexity filtering is insufficient to block them.
Paper analysis
What problem does this paper attempt to solve?
The authors study semantic collisions: texts that are semantically unrelated but judged as similar by NLP models, and demonstrate that four types of tasks are vulnerable to attack.
Core problem: NLP models have semantic collision vulnerabilities when judging the semantic similarity of texts—semantically unrelated texts are judged as similar by the model.
- Problem scenario: The authors point out that many NLP applications rely on analyzing text meaning and similarity, including paraphrase identification (merging similar content, deduplication), document retrieval, reply suggestion (Smart Reply), and extractive summarization. If an attacker injects collision text, it could lead to incorrect merging, unrelated documents rising in ranking, spam push, or incorrect summaries.
- Difference from adversarial examples: The authors claim that semantic collisions are the "inverse" of adversarial examples—adversarial examples are similar inputs producing different outputs, whereas semantic collisions are dissimilar inputs producing similar outputs. Previous NLP adversarial attacks mostly aimed to minimally perturb the input to change the output; this paper's goal is the opposite.
- Core assumption: Given white-box access, an attacker can generate, via gradient optimization, a collision c that is semantically unrelated to the target input x but has a high similarity score S(x, c); and can use LM constraints to make the collision look natural and evade perplexity-based filtering.
- Paper contributions: The authors propose three gradient-based collision generation methods (aggressive, regularized aggressive, natural), evaluate them on SOTA models across four tasks, and discuss the limitations of defenses such as perplexity filtering.
- Threat model:
- Attacker goal: Generate a collision c that is semantically unrelated to the target input x but judged as similar by model f, for delivering spam, boosting the ranking of unrelated candidates, or manipulating summaries.
- Knowledge: full knowledge of the target model (white-box), including architecture and parameters; the authors believe it could potentially be transferred to black-box via model extraction, left as future work.
- Capability: Control part of the input, such as inserting or modifying candidate documents in a retrieval system.
- Victim systems: Applications that use semantic similarity models, including Quora-style content merging, retrieval systems, Smart Reply, and summarization systems.
What related research exists?
Related work falls into three groups: adversarial examples in NLP, attacks that change input semantics, and feature collisions in CV; this paper positions itself as their "inverse" problem.
Adversarial examples in NLP
- Hosseini et al. (2017)—deceive toxic-comment classifiers via perturbations such as inserted dots or spaces.
- HotFlip (Ebrahimi et al., 2018)—uses gradients to find perturbations on white-box models; Wallace et al. (2019) extend this to inserting short trigger text. The authors state that this paper's goal is the inverse of adversarial examples: generating inputs that are semantically very different but treated as similar by the model.
- Rule-based, heuristic, or generative-model methods (Mahler et al., 2017; Ribeiro et al., 2018; Iyyer et al., 2018; Zhao et al., 2018)—the authors only describe these without further comparison.
Attacks that change input semantics
- Jia and Liang (2017)—insert heuristically constructed sentences into passages to deceive QA systems into selecting answers from the inserted sentences.
- Wallace et al. (2020)—meaningless text generated by HotFlip can be translated by black-box translation systems into meaningful malicious output. The authors state that this paper extends the idea of changing input semantics to another class of NLP models, designs a new non-perturbation-based gradient method that is more effective than HotFlip, and can generate "natural" collisions that evade perplexity defenses.
Feature collisions in computer vision
- Jacobsen et al. (2019a)—images of different classes may receive the same representation due to excessive model invariance.
- Jacobsen et al. (2019b)—attackers can modify inputs to change the class without affecting model predictions.
- Li et al. (2019)—inherent properties of ReLU activations can give images with different labels the same feature vector.
Baselines and benchmarks: The paper uses a HotFlip-based greedy baseline (HF) for comparison, evaluated on five datasets: MRPC, QQP, Core17/18, Persona-chat, and CNN/DailyMail.
The authors position this paper as: semantic collisions are the inverse problem of adversarial examples, targeting the class of semantic-similarity-judging models, which has not previously been attacked.
How does the paper address this problem?
The authors propose gradient-based collision generation: continuous relaxation optimization plus beam search, with two LM-constrained variants to evade perplexity filtering.
Overall approach: Given an input x and a white-box similarity function S, collision generation is formalized as the optimization problem argmaxc ∈ X S(x, c) with x and c semantically unrelated, solved using gradient methods.
Problem setting and formalization
- Goal: Generate a collision c of fixed length T that maximizes S(x, c); assume the model can accept hard one-hot words or soft words (probability vectors w̌ ∈ ∆|V|−1).
- Unrelatedness guarantee: During generation, filter words related to x from the vocabulary V—first remove non-stopwords in x, then remove the 500 to 2,000 words in V with the highest similarity to x.
Aggressive Collisions
- Soft collision optimization: Relax the word choice at each position t into a continuous logit vector zt, with the soft word defined as čt = softmax(zt /τ), where τ is the temperature; perform gradient ascent on z to maximize S(x, č).
- Hard collision search: Use left-to-right beam search, taking the top K words of zt at each step and ranking them by S(x, c1:t−1 ⊕ w ⊕ čt+1:T).
- Iterative optimization: If the similarity has not converged, use label smoothing (ε=0.1) to convert the hard solution back into continuous space to initialize the next round; repeat until S converges.
Constrained Collisions
- Goal: Jointly maximize similarity and LM likelihood: max(1 − β) · S(x, c) + β · log P (c; g), β ∈ [0, 1].
- Regularized aggressive: Add a regularizer Ω = Σt H(čt, P (wt|č1:t−1; g)) to the soft collision to approximate the LM likelihood; and exploiting the LM's property of assigning low perplexity to repeated common tokens, constrain a contiguous segment of tokens in c to be chosen from the most common English words, which the authors claim makes collisions less fluent but able to evade LM filtering.
- Natural: Inspired by Plug and Play LM, progressively perturb the LM logits: zt = `t + δt, optimizing similarity with a few gradient steps on δt; then use joint beam search, evaluating S at each step only for the top K words most likely under the LM, and updating the beam by the joint score in Eq 5.
Baselines and implementation
- HotFlip baseline: Initialize with a repeated-word sequence, iteratively replace the word at each position using the first-order Taylor approximation arg max(ei − ev)⊤∇et S(x, c), and flip after evaluating the top K.
- LM choice: When the target model and the available LM have different vocabularies, fine-tune BERT on Wikitext-103 as an autoregressive LM; when the target is RoBERTa-based, use pretrained GPT-2 (shared vocabulary).
- Hyperparameters: Use Adam for gradient ascent; beam size B, top-k K, number of iterations N, step size η=0.001, temperature τ, and β for each task are given in Appendix Table 6 (e.g., MRPC aggressive: B=10, K=30, N=30, T=20, τ=1.0, β=0.0).
What experiments did the paper conduct?
Attacking SOTA models on four tasks and five datasets, the aggressive collision success rate is 86%–100%, and constrained collisions can evade perplexity filtering.
Experimental Setup
- Models under test: BERT base for MRPC (F1 87.51%), RoBERTa base for QQP (accuracy 91.6%), Birch for Core17/18 (BERT reranking after BM25/RM3 retrieval of 1000 candidates), Bi-encoder and Poly-encoder for Chat, and PreSumm for CNNDM.
- Datasets: MRPC and QQP (first 1,000 pairs of each attack validation set), Core17/18 (50 query topics, attacking irrelevant articles ranked 900–1000 by Birch), Persona-chat (first 1,000 dialogue contexts, 20 candidates), CNN/DailyMail (first 1,000 articles).
- Baselines: HotFlip (HF) greedy attack; Gold is the similarity between the ground truth and x.
- Metrics: similarity S; MRPC/QQP report the success rate at S>0.5; Core17/18 report the proportion of irrelevant articles entering the top-10/top-100; Chat reports the top-1 proportion; CNNDM reports the top-1/top-3 proportion.
- Irrelevance evaluation: BERTScore (FBERT reported for MRPC/QQP/CNNDM, PBERT for Core17/18 and Chat).
- Perplexity filtering evaluation: perplexity measured with GPT-2, reporting FP@90/FP@80 (the proportion of real data mistakenly affected when 90%/80% of collisions are filtered).
Main Results
According to Table 2:
Swipe horizontally to read the table
Task Metric HF Aggr. Aggr. Ω Nat. MRPC % Succ 67.3% 97.8% 81.0% 98.6% QQP % Succ 54.8% 97.3% 91.1% 88.8% Core17/18 r≤10 0.0% 49.9% 20.6% 12.3% Core17/18 r≤100 16.5% 86.7% 69.7% 60.6% Chat-Bi r=1 78.5% 99.8% 92.9% 86.0% Chat-Poly r=1 73.1% 99.4% 90.7% 86.6% CNNDM r=1 67.9% 99.4% 90.7% 30.4% CNNDM r≤3 96.5% 100.0% 100.0% 77.7% - The authors state that aggressive collisions outperform HotFlip on all tasks, and constrained collisions are also often better; the S of aggressive collisions is always higher than that of the ground truth.
- The authors believe constrained collisions perform worse on Core17/18, possibly because query topics are compact phrases with narrow semantics, making constrained collisions harder to find.
- On CNNDM, natural collisions achieve only 30.4% top-1, clearly lower than the other variants.
Irrelevance Verification
- Method: Table 3 reports the BERTScore between collisions and the target input, compared against Gold (the score between the target input and the ground truth).
- Results: The BERTScore of all collisions is negative (MRPC: Aggr. −0.22, Aggr. Ω −0.34, Nat. −0.12; Gold 0.66), while Gold is always positive; the authors state this shows the collisions are irrelevant to the target input.
- Authors' interpretation: Because aggressive and regularized collisions are meaningless, their contextualized representations are less similar to the reference text than those of natural collisions.
Transferability
- Setup: Table 5, where f′ on MRPC is a BERT or RoBERTa trained with different random seeds; on Chat, Bi-encoder and Poly-encoder transfer to each other (both are fine-tuned from the same pretrained transformer).
- Results: With the same architecture and the same pretrained model, transfer rates are 40%–70% (e.g., Chat Bi→Poly: Aggr. 77.4%, Nat. 71.4%; MRPC BERT→BERT: Aggr. 64.5%); transfer between BERT and RoBERTa is 0.0%.
- Authors' interpretation: The authors state that the attacks in this paper produce more transferable collisions than HotFlip; transfer across different pretrained models is left as future work.
Perplexity Filtering Evaluation
- Method: Figure 2 shows histograms of log perplexity under GPT-2 for real data and collisions; Table 4 reports FP@90/FP@80.
- Results: HF and aggressive collisions can be filtered with almost no false positives (e.g., MRPC Aggr. FP@90 is 0.0%); constrained collisions have high false-positive rates—on MRPC, Nat. FP@90 is 94.9%, and on Chat, Aggr. Ω FP@90 is 76.5% and Nat. is 93.8%.
- Authors' interpretation: The authors state that there is a gap between the distributions of real data and aggressive collisions, so a threshold may be found for filtering; however, constrained collisions overlap with the real-data distribution, and perplexity filtering performs worst on MRPC and Chat, mistakenly affecting about 85%–90% of real data.
Other Ablations and Analyses
- Runtime: generating one collision takes 10–60 seconds on a single GeForce RTX 2080, depending on the target input length (Appendix A).
- Hyperparameters: B, K, N, T, η, τ, β for each task are given in Appendix Table 6; aggressive uses label smoothing ε=0.1, and baseline hyperparameters are the same as aggressive.
- Appendix B (Tables 7–10) gives collision examples for the four tasks along with model output scores or rankings.
What are some points that can be further explored?
The authors list future work such as black-box transfer, learning-based filtering evaluation, and adversarial training; experiments cover five datasets and BERT-family models.
Limitations and future directions noted by the authors
- Black-box transfer (Section 3): The authors believe white-box attacks could potentially be transferred to black-box settings via model extraction, and leave this as future work.
- Cross-pretrained-model transfer (Section 5.4): There is no transfer between different pretrained models (BERT and RoBERTa); the authors leave the study of transfer across pretrained model types as future work.
- Evaluation of learning-based filtering (Section 6): The authors note that a binary classifier could potentially filter collisions, but per the principle of Carlini et al. (2019), defenses should assume the attacker fully knows the defense mechanism, and a stronger attacker could exploit the detection model to construct collisions that evade it; the authors leave thorough evaluation of such defenses as future work.
- Adversarial training (Section 6): The authors believe adversarial training with collisions could improve robustness, but each training sample requires an additional search every epoch, which is inefficient, so they leave it as future work.
- More effective defenses (Section 7): The authors state that simple perplexity filtering is insufficient to mitigate the attack, and more effective defenses need to be studied.
Scope of experiments
- The models tested are BERT, RoBERTa, Birch, Bi-encoder, Poly-encoder, and PreSumm, 6 in total, all pretrained transformers fine-tuned on the corresponding tasks.
- The datasets are MRPC, QQP, Core17/18, Persona-chat, and CNN/DailyMail, 5 in total; for MRPC/QQP/Chat/CNNDM the first 1,000 samples of each validation set are attacked, and Core17/18 uses 50 query topics.
- The defense evaluation covers only perplexity filtering (evaluated with GPT-2); learning-based filtering and adversarial training were not experimented on.
- The transferability experiments cover only the MRPC and Chat tasks.
- The paper does not report a query budget for the attack, nor the number of repeated experiments or variance.
Summarize the main content of the paper
The authors propose the semantic collision attack, using a gradient method to generate text that is semantically unrelated but judged as similar, with success rates up to 100% on four tasks.
An NLP adversarial attack paper that studies semantic collision vulnerabilities in semantic similarity judgment models.
- Problem: Tasks such as paraphrase identification, document retrieval, reply suggestion, and extractive summarization rely on semantic similarity; the authors claim that an attacker can inject semantically unrelated collision text that the model judges as similar, causing consequences such as incorrect merging, ranking manipulation, and spam delivery.
- Method: Under a white-box threat model, collision generation is formalized as an optimization that maximizes S(x, c); the aggressive method uses continuous relaxation with temperature annealing plus iterative beam search; regularized aggressive adds an LM likelihood regularizer and constrains some tokens to be high-frequency words; the natural method perturbs LM logits for joint beam search. During generation, words related to x are filtered out to ensure unrelatedness.
- Main results: On MRPC/QQP, aggressive collision success rates are 97.8%/97.3%; on Core17/18, 49.9% of unrelated documents are promoted to top-10; on Chat, the Bi/Poly-encoder top-1 proportions are 99.8%/99.4%; on CNNDM, top-3 reaches 100.0% (Table 2). BERTScore verifies that collisions are semantically unrelated to the input (Table 3).
- Transfer and defenses: Transfer rates between models of the same architecture and pretraining are 40%–70%, and between BERT and RoBERTa are 0% (Table 5); perplexity filtering can block aggressive collisions, but for constrained collisions it falsely flags a large amount of real data (on MRPC, Nat. FP@90 is 94.9%, Table 4).
- Authors' conclusion: The authors claim this demonstrates a new class of vulnerability in NLP applications, that simple perplexity filtering is insufficient as a defense, and point to black-box transfer, evaluation of learning-based defenses, and adversarial training as future directions.