Robustness Tokens: Towards Adversarial Robustness of Transformers
Brian Pulfer, Yury Belousov, Slava Voloshynovskiy
TL;DR
This work tackles the vulnerability of publicly available Vision Foundation Models to adversarial inputs by introducing Robustness Tokens, a small set of private input tokens appended to transformer sequences. The tokens are trained with two objectives, $\\mathcal{L}_{\\text{inv}}(\\mathbf{r})$ and $\\mathcal{L}_{\\text{adv}}(\\mathbf{r})$, so that representations remain stable on clean data and align under adversarial perturbations via $\\mathcal{L}(\\mathbf{r}) = \\mathcal{L}_{\\text{inv}}(\\mathbf{r}) + \\mathcal{L}_{\\text{adv}}(\\mathbf{r})$, while updating only $\\mathbf{r}$. Empirical results on DiNOv2, OpenCLIP, and DEIT-III show that Robustness Tokens preserve downstream performance while substantially improving robustness against white-box attacks, generalize to attacks like AutoAttack, and converge rapidly with low training cost. The approach also reveals that larger models exhibit larger robustness gains and that massive activations observed in transformers can be mitigated by the tokens, suggesting practical, efficient defenses for transformer backbones in real-world deployments.
Abstract
Recently, large pre-trained foundation models have become widely adopted by machine learning practitioners for a multitude of tasks. Given that such models are publicly available, relying on their use as backbone models for downstream tasks might result in high vulnerability to adversarial attacks crafted with the same public model. In this work, we propose Robustness Tokens, a novel approach specific to the transformer architecture that fine-tunes a few additional private tokens with low computational requirements instead of tuning model parameters as done in traditional adversarial training. We show that Robustness Tokens make Vision Transformer models significantly more robust to white-box adversarial attacks while also retaining the original downstream performances.
