Transfer learning from pretrained language models recently became thedominant approach for solving many NLP tasks. While fine-tuning large languagemodels usually gives the best performance, in many applications it ispreferable to tune much smaller sets of parameters, so that the majority ofparameters can be shared across multiple tasks. The main approach is to trainone or more task-specific layers on top of the language model. In this paper wepresent an alternative approach based on adversarial reprogramming, whichextends earlier work on automatic prompt generation. It attempts to learntask-specific word embeddings that, when concatenated to the input text,instruct the language model to solve the specified task. We show that thisapproach outperforms other methods with a similar number of trainableparameters on SST-2 and MNLI datasets. On SST-2, the performance of our modelis comparable to the fully fine-tuned baseline, while on MNLI it is the bestamong the methods that do not modify the parameters of the body of the languagemodel.