AdvQDet: Detecting Query-Based Adversarial Attacks with Adversarial Contrastive Prompt Tuning

Xin Wang, Kai Chen, Xingjun Ma, Zhineng Chen, Jingjing Chen, Yu-Gang Jiang

Introduction: The Threat of Query-Based Attacks

Deep Neural Networks (DNNs) are vulnerable to adversarial examples—inputs carefully crafted to trigger misclassification. While white-box attacks are well-documented, query-based black-box attacks present a more practical threat to commercial Machine Learning as a Service (MLaaS) platforms. In these attacks, an adversary iteratively queries a model, using the feedback (probabilities or labels) to refine their perturbations until the target model fails.

Overview of the MLaaS threat model where an attacker uses iterative queries to find adversarial examples.

Existing defenses, such as adversarial training, often degrade performance on clean data or are computationally expensive. Stateful detection methods, which analyze query history, are a promising alternative but often fall short against "Sybil" attacks (using multiple accounts) or adaptive attackers who intentionally vary their query patterns to avoid detection.

The AdvQDet Framework

AdvQDet is a stateful detection framework designed to recognize the "fingerprint" of iterative queries. It is based on the observation that intermediate queries in a black-box attack are essentially perturbations of the same root image. Consequently, these queries should cluster together in a robust embedding space.

The AdvQDet architecture: from input images to CLIP-based embedding and similarity-based defense.

Adversarial Contrastive Prompt Tuning (ACPT)

To build a robust detector, AdvQDet utilizes a CLIP image encoder fine-tuned through Adversarial Contrastive Prompt Tuning (ACPT). This method employs a two-stream contrastive approach:

  1. Clean Stream (C2C): Standard contrastive learning that aligns different augmentations of the same clean image.
  2. Adversarial Stream (A2A): A novel stream that pulls together different adversarially perturbed versions of the same image.

Instead of retraining the entire CLIP backbone, AdvQDet learns a small set of "prompt tokens" concatenated to the input. This maintains efficiency while leveraging CLIP's extensive pre-trained knowledge.

Detection and Defense Mechanism

When a query is received, AdvQDet:

  1. Generates an embedding using the ACPT-tuned encoder.
  2. Compares this embedding against a Global Embedding Bank that stores query history across all users, effectively neutralizing Sybil attacks.
  3. If the similarity to a previous query exceeds a set threshold, the system flags an attack.
  4. Defense Action: Rather than blocking the user—which would signal the attacker—AdvQDet returns a cached output from a previous query. This "starves" the attacker of the new information required for gradient estimation, breaking the optimization loop silently.

Evaluation and Results

AdvQDet was evaluated across five image classification benchmarks (CIFAR-10, GTSRB, ImageNet, Flowers, and Pets) and a specialized Vision-Language Model (VLM) benchmark (AttackVLM).

  • High Detection Accuracy: AdvQDet achieved an average detection rate of over 99% across seven state-of-the-art attack types, including Boundary, HSJA, and Square attacks.
  • Rapid Response: On average, malicious sequences were identified within just 2.66 queries.
  • Robustness to Adaptive Attacks: Even when attackers were aware of the detection mechanism, AdvQDet remained effective, particularly as the number of learned prompt tokens increased.

Conclusion

AdvQDet represents a significant step forward in securing MLaaS platforms. By making the detector invariant to adversarial noise through ACPT and utilizing a global embedding bank, it provides a robust, efficient, and "silent" defense against sophisticated query-based attacks. Future work will focus on scaling the embedding bank to handle billions of queries and addressing more complex multimodal attack vectors.

Summary updated

BibTeX
@inproceedings{wang2024advqdet,
  author = {Xin Wang and Kai Chen and Xingjun Ma and Zhineng Chen and Jingjing Chen and Yu-Gang Jiang},
  title = {{AdvQDet: Detecting Query-Based Adversarial Attacks with Adversarial Contrastive Prompt Tuning}},
  booktitle = {ACM Multimedia},
  year = {2024},
  url = {https://openreview.net/forum?id=VMdcfUn5Ms},
}
Figure