Algorithmic Capabilities of Random Transformers

Ziqian Zhong, Jacob Andreas
10/6/2024
cs.LGcs.AIcs.CL

Official code: fjzzq2002/random_transformers (15 stars, MIT, last commit 2024-09-28).

Abstract

Trained transformer models have been found to implement interpretable procedures for tasks like arithmetic and associative recall, but little is understood about how the circuits that implement these procedures originate during training. To what extent do they depend on the supervisory signal provided to models, and to what extent are they attributable to behavior already present in models at the beginning of training? To investigate these questions, we investigate what functions can be learned by randomly initialized transformers in which only the embedding layers are optimized, so that the only input--output mappings learnable from data are those already implemented (up to a choice of encoding scheme) by the randomly initialized model. We find that these random transformers can perform a wide range of meaningful algorithmic tasks, including modular arithmetic, in-weights and in-context associative recall, decimal addition, parenthesis balancing, and even some aspects of natural language text generation. Our results indicate that some algorithmic capabilities are present in transformers (and accessible via appropriately structured inputs) even before these models are trained. Code is available at https://github.com/fjzzq2002/random_transformers.

View on arXivView PDF

Code Implementations(1)

MIT

Official code for "Algorithmic Capabilities of Random Transformers" (NeurIPS 2024)

152PythonSep 28, 20242 years agoMIT

Similar Papers

Cite this paper

@article{zhong2024algorithmic,
  title  = {Algorithmic Capabilities of Random Transformers},
  author = {Ziqian Zhong and Jacob Andreas},
  year   = {2024},
  eprint = {2410.04368},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2410.04368},
  url    = {http://arxiv.org/abs/2410.04368v1},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.04368.svg)](https://codeofpaper.com/paper/2410.04368)

Discussion