Skip to main content
QUICK REVIEW

[Paper Review] Single Headed Attention RNN: Stop Thinking With Your Head

Stephen Merity|arXiv (Cornell University)|Nov 26, 2019
Topic ModelingComputer Science17 references62 citations
TL;DR

The paper presents SHA-RNN, a single-head attention augmented LSTM model that approaches state-of-the-art byte-level language modeling on enwik8 using minimal hyperparameter tuning on a single GPU, challenging the necessity of many attention heads. It also discusses tokenization sensitivity and practical considerations for training efficiency.

ABSTRACT

The leading approaches in language modeling are all obsessed with TV shows of my youth - namely Transformers and Sesame Street. Transformers this, Transformers that, and over here a bonfire worth of GPU-TPU-neuromorphic wafer scale silicon. We opt for the lazy path of old and proven techniques with a fancy crypto inspired acronym: the Single Headed Attention RNN (SHA-RNN). The author's lone goal is to show that the entire field might have evolved a different direction if we had instead been obsessed with a slightly different acronym and slightly different result. We take a previously strong language model based only on boring LSTMs and get it to within a stone's throw of a stone's throw of state-of-the-art byte level language model results on enwik8. This work has undergone no intensive hyperparameter optimization and lived entirely on a commodity desktop machine that made the author's small studio apartment far too warm in the midst of a San Franciscan summer. The final results are achievable in plus or minus 24 hours on a single GPU as the author is impatient. The attention mechanism is also readily extended to large contexts with minimal computation. Take that Sesame Street.

Motivation & Objective

  • Motivate exploring non-transformer-centric architectures for language modeling and demonstrate competitive results with a low-resource, LSTM-based approach.
  • Introduce a simple, memory-efficient attention mechanism integrated with an LSTM (SHA-RNN) and a Boom feed-forward layer.
  • Show that a single attention head can yield most gains and that memory/compute efficiency enables fast training on commodity hardware.
  • Discuss implications for tokenization, training tooling, and the broader research direction beyond Transformer-dominated literature.

Proposed method

  • Propose the SHA-RNN architecture combining an embedding layer, one or more SHA-RNN layers with a single attention head, and a softmax classifier with tied weights.
  • Use a simplified attention mechanism with a single head and a memory that is written once (no large per-timestep matrix multiplications).
  • Introduce the Boom layer, a computationally efficient feed-forward component that replaces a portion of traditional down-projection layers.
  • Apply a minimum-trust version of the LAMB optimizer to improve convergence on networks without residual connections.
  • Experiment on byte-level enwik8 and discuss comparisons to word-level tokenization and WikiText datasets.

Experimental results

Research questions

  • RQ1Can a single-headed attention mechanism atop an LSTM approach or match state-of-the-art byte-level language modeling with minimal tuning?
  • RQ2How does reducing attention heads affect performance and training efficiency on enwik8?
  • RQ3What are the practical implications of tokenization schemes on perplexity and comparability across models?
  • RQ4What architectural components (Boom layer, over-parameterized static vectors) contribute to training stability and performance?

Key findings

  • SHA-RNN with a single attention head nearly matches multi-head configurations in performance gains.
  • Training with minimal hyperparameter tuning on a single GPU yields competitive results within approximately the training time described (epoch times around 1800 seconds for some setups).
  • For the enwik8 experiments, a single-head SHA-LSTM achieved significant improvements in efficiency, with the 1-head model training faster than the 4-head variant (approximately 30 minutes per epoch vs ~67 minutes).
  • The Boom layer reduces parameters and computation compared to traditional down-projection layers while delivering strong performance.
  • Tokenization choices can significantly affect perplexity, highlighting potential tokenization attacks and the difficulty of fair cross-model comparisons when tokenization differs.
  • The work argues for maintaining model diversity beyond Transformers, suggesting SHA-RNN as a viable alternative and a potential basis for distillation or broader accessibility.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.