ΑΙhub.org
 

Pretrained transformers as universal computation engines


by
29 April 2021



share this:
input-output token

By Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch

Transformers have been successfully applied to a wide variety of modalities: natural language, vision, protein modeling, music, robotics, and more. A common trend with using large models is to train a transformer on a large amount of training data, and then finetune it on a downstream task. This enables the models to utilize generalizable high-level embeddings trained on a large dataset to avoid overfitting to a small task-relevant dataset.

We investigate a new setting where instead of transferring the high-level embeddings, we instead transfer the intermediate computation modules – instead of pretraining on a large image dataset and finetuning on a small image dataset, we might instead pretrain on a large language dataset and finetune on a small image dataset. Unlike conventional ideas that suggest the attention mechanism is specific to the training modality, we find that the self-attention layers can generalize to other modalities without finetuning.

To illustrate this, we take a pretrained transformer language model and finetune it on various classification tasks: numerical computation, vision, and protein fold prediction. Then, we freeze all the self-attention blocks except for the layer norm parameters. Finally, we add a new linear input layer to read in the new type of input, and reinitialize a linear output layer to perform classification on the new task. We refer to this as “Frozen Pretrained Transformer”.

Across the tasks, a token fed to the model represents a small amount of information: for example, it could be a single bit, or a 4×4 image patch. In particular, the tokens can only communicate with each other via the self-attention mechanism, which is not being trained at all on the downstream task. We investigate if these mechanisms – learned exclusively from natural language data – can be used for another modality in zero shot.

We show test accuracies for a variety of tasks below. We FPT can match or improve the performance of training a transformer fully from scratch! This indicates that, somehow, the attention mechanisms are general enough that we can feed in relatively arbitrary inputs and still generate useful embeddings for downstream classification.



We also find that, when computing the elementwise XOR of two bitstrings, despite the self-attention parameters being frozen, by learning input embeddings to feed into the attention layer it is possible to force the self-attention to attend to the relevant bits for strings of length up to 256 (length of 5 shown below):



An open question is then what the benefit of pretraining on language is. Instead of initializing the transformer parameters from a pretrained model, we could instead initialize them randomly or by pretraining on the Bit Memory task, which ablate against no supervision or weak memory supervision, instead. Our results indicate that all three methods of initialization can work well, but language still performs the best, somehow providing an interesting set of pretrained layers: for example, on CIFAR-10, the base FPT model achieves an accuracy of 68%, versus 63% from Bit Memory pretraining or 62% from random initialization. Furthermore, we find the language-pretrained frozen transformers converge faster than the randomly initialized frozen transformers, typically by a factor of 1-4x, indicating that language might be a good starting point for other tasks.

We also find the transformer architecture itself to be very important. If we compare a randomly initialized frozen transformer to a randomly initialized frozen LSTM, the transformer significantly outperforms the LSTM: for example, 62% vs 34% on CIFAR-10. Thus, we think attention may already be a naturally good prior for multimodal generalization; we could think of self-attention as applying data-dependent filters.

We’re very interested in a better understanding of the capability of language models or hybrid-modality transformers for the goal of a universal computation engine. We think there are a lot of open questions to be explored in this space, and are excited to see new work in multimodal training.


This post is based on the following paper:

This article was initially published on the BAIR blog, and appears here with the authors’ permission.




BAIR blog

            AUAI is supported by:



Subscribe to AIhub newsletter on substack



Related posts :

The Machine Ethics podcast: Data Collective with E.M. Lewis-Jong

Ben chats to E.M. Lewis-Jong about the promise of AI and making human connection easier, speech recognition and supporting linguistic diversity, making useful technologies that have a purpose, and more.

AI for ethology: an interview with Isla Duporge

  08 Sep 2026
Deep learning is becoming a powerful tool for understanding animal behaviour and tracking populations.

AI in cardiology: The path to practical application carries risks

  07 Sep 2026
Can artificial intelligence help us better combat cardiovascular diseases? Legal researcher Hannah van Kolfschooten urges caution, as there are still many legal issues that need to be resolved.

AI-powered camera system offers low-cost way to monitor bumblebees

  04 Sep 2026
Researchers have developed a semi-automated method that uses remote cameras to survey bumblebees and potentially other insects.

Interview with Noah Golowich – theoretical foundations for learning in games and dynamic environments

  03 Sep 2026
Noah Golowich tells us about his research into the theory of decision making and learning in games, which have applications in Multi-Agent Reinforcement Learning.

Forthcoming machine learning and AI seminars: September 2026 edition

  02 Sep 2026
A list of free-to-attend AI-related seminars that are scheduled to take place in the next couple of months.
AI pioneers

Combining cultures, from code to canvas: an interview with Ken Goldberg

  01 Sep 2026
AI Pioneer Ken Goldberg on the clash of cultures within robotics, his career bridging art and science, and the meteoric rise of agentic robotics.

What happens when AI runs out of pictures?

AI is data-hungry and needs thousands of images to learn how to detect tumours or product defects, but often very few are available. A new method aims to change that.



AUAI is supported by:







Subscribe to AIhub newsletter on substack




 















©2026.05 - Association for the Understanding of Artificial Intelligence