Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Kumano, Soichiro, Kera, Hiroshi, Yamasaki, Toshihiko
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866917300948434944
author Kumano, Soichiro
Kera, Hiroshi
Yamasaki, Toshihiko
author_facet Kumano, Soichiro
Kera, Hiroshi
Yamasaki, Toshihiko
contents Adversarial training is one of the most effective defenses against adversarial attacks, but it incurs a high computational cost. In this study, we present the first theoretical analysis suggesting that adversarially pretrained transformers can serve as universally robust foundation models -- models that can adapt robustly to diverse downstream tasks with only lightweight tuning. Specifically, we demonstrate that single-layer linear transformers, after adversarial pretraining across a variety of classification tasks, can generalize robustly to unseen classification tasks through in-context learning from clean demonstrations (i.e., without requiring additional adversarial training or examples). This universal robustness stems from the model's ability to adaptively focus on robust features within given tasks. We also identify two open challenges for attaining robustness: the accuracy-robustness trade-off and sample-hungry training. This study initiates the discussion on the utility of universally robust foundation models. While their training is expensive, the investment would prove worthwhile as downstream tasks can obtain adversarial robustness for free. The code is available at https://github.com/s-kumano/universally-robust-in-context-learner.
format Preprint
id arxiv_https___arxiv_org_abs_2505_14042
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners
Kumano, Soichiro
Kera, Hiroshi
Yamasaki, Toshihiko
Machine Learning
Computer Vision and Pattern Recognition
Adversarial training is one of the most effective defenses against adversarial attacks, but it incurs a high computational cost. In this study, we present the first theoretical analysis suggesting that adversarially pretrained transformers can serve as universally robust foundation models -- models that can adapt robustly to diverse downstream tasks with only lightweight tuning. Specifically, we demonstrate that single-layer linear transformers, after adversarial pretraining across a variety of classification tasks, can generalize robustly to unseen classification tasks through in-context learning from clean demonstrations (i.e., without requiring additional adversarial training or examples). This universal robustness stems from the model's ability to adaptively focus on robust features within given tasks. We also identify two open challenges for attaining robustness: the accuracy-robustness trade-off and sample-hungry training. This study initiates the discussion on the utility of universally robust foundation models. While their training is expensive, the investment would prove worthwhile as downstream tasks can obtain adversarial robustness for free. The code is available at https://github.com/s-kumano/universally-robust-in-context-learner.
title Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners
topic Machine Learning
Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2505.14042