Reservoir Transformers

Sheng Shen, Alexei Baevski, Ari S. Morcos, Kurt Keutzer, Michael Auli, Douwe Kiela

Abstract

Transformers have become the cornerstone of modern natural language processing, yet their computational demands remain a significant barrier. This paper investigates whether every layer in a Transformer requires gradient updates to achieve high performance. We introduce Reservoir Transformers, an architecture that intersperses standard trainable layers with frozen, randomly initialized "reservoir" blocks. Our findings demonstrate that these models can achieve faster convergence, reduced computational costs, and improved generalization. Notably, Feed-Forward Network (FFN) reservoirs often outperform full Transformer reservoirs, suggesting that fixed random projections can effectively handle non-linear feature transformations when contextualized by surrounding trainable layers.

Introduction

The success of Transformers is often attributed to their massive parameter counts, which unfortunately lead to skyrocketing energy and time requirements for training. This study addresses a fundamental question: Is every parameter in a Transformer actually performing work that necessitates gradient updates? Drawing inspiration from the paradigm of reservoir computing—where a fixed, random high-dimensional reservoir processes input for a simple readout layer—we explore treating segments of the Transformer as fixed reservoirs to save compute without sacrificing accuracy.

Methods and Architecture

Reservoir Transformers modify the standard stack of $N$ trainable layers by interspersing them with fixed, randomly initialized blocks. Two primary architectural variations were explored:

  1. Transformer Reservoir: A standard Transformer layer (Self-Attention + FFN) where all parameters are frozen after initialization.
  2. FFN Reservoir: A simplified frozen layer consisting solely of a Feed-Forward Network, omitting the self-attention mechanism.

To evaluate the efficiency-performance trade-off, we utilize the Area Under the Convergence Curve (AUCC) metric. AUCC measures the performance delivered (e.g., BLEU score) relative to total wall-clock training time, rewarding models that reach high accuracy rapidly.

Additionally, we explore Backskipping, an optimization where the backward pass is entirely skipped for reservoir layers. Instead of calculating exact gradients through the frozen block, the model uses approximations to update the layers situated below the reservoir.

Key Results and Insights

Our experiments across machine translation (IWSLT’14, WMT’16) and language modeling (enwiki8) benchmarks reveal several critical insights:

  • Efficiency Gains: Reservoir Transformers consistently converged faster than standard baselines. On the WMT dataset, these models saved up to 27% in wall-clock time to reach peak performance compared to a standard 24-layer Transformer.
  • The Power of FFN Reservoirs: Surprisingly, FFN Reservoirs often outperformed full Transformer Reservoirs. This suggests that while the model must learn context-dependent attention, it can rely on fixed random projections for non-linear transformations.
  • Improved Generalization: In several instances, Reservoir Transformers outperformed fully trained models on test sets. The frozen layers likely act as a form of regularization, preventing over-parameterization and overfitting.
Performance and efficiency (AUCC) of Reservoir Transformers across varying numbers of updatable layers for translation (BLEU) and language modeling (bpc) tasks.

As shown in the figure above, Reservoir Transformers (particularly the FFN Reservoir variant) maintain competitive test performance while often achieving superior AUCC scores compared to standard Transformers, especially when the number of updatable layers is limited.

Discussion and Future Work

Probing tasks indicate that even frozen layers "learn" to represent complex linguistic phenomena because they are contextualized by the trainable layers surrounding them. This suggests that fixed random layers act as a strong prior, projecting data into high-dimensional spaces where it becomes more easily interpretable by the trainable "readout" layers.

While promising, the approach has limitations. Performance may degrade in extremely deep models if the number of trainable layers becomes too sparse. Future research will focus on hardware optimization, as hardwiring these fixed layers into specialized hardware like FPGAs could lead to even more dramatic efficiency gains.

Summary updated

BibTeX
@inproceedings{shen2021reservoir,
  author = {Sheng Shen and Alexei Baevski and Ari S. Morcos and Kurt Keutzer and Michael Auli and Douwe Kiela},
  title = {{Reservoir Transformers}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.331},
}
Figure