# Theoretical Limitations of Self-Attention in Neural Sequence Models

**Authors:** Michael Hahn

arXiv: 1906.06755 · 2021-06-28

## TL;DR

This paper provides a theoretical analysis showing that self-attention mechanisms in neural sequence models have fundamental limitations in modeling hierarchical and periodic structures, which are essential in natural language processing.

## Contribution

It rigorously demonstrates the computational limitations of self-attention in modeling formal languages, highlighting the need for additional complexity in neural models.

## Key findings

- Self-attention cannot model periodic finite-state languages.
- Self-attention cannot capture hierarchical structures without increasing layers or heads.
- Limitations persist across both soft and hard attention mechanisms.

## Abstract

Transformers are emerging as the new workhorse of NLP, showing great success across tasks. Unlike LSTMs, transformers process input sequences entirely through self-attention. Previous work has suggested that the computational capabilities of self-attention to process hierarchical structures are limited. In this work, we mathematically investigate the computational power of self-attention to model formal languages. Across both soft and hard attention, we show strong theoretical limitations of the computational abilities of self-attention, finding that it cannot model periodic finite-state languages, nor hierarchical structure, unless the number of layers or heads increases with input length. These limitations seem surprising given the practical success of self-attention and the prominent role assigned to hierarchical structure in linguistics, suggesting that natural language can be approximated well with models that are too weak for the formal languages typically assumed in theoretical linguistics.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1906.06755/full.md

## Figures

3 figures with captions in the complete paper: https://tomesphere.com/paper/1906.06755/full.md

## References

58 references — full list in the complete paper: https://tomesphere.com/paper/1906.06755/full.md

---
Source: https://tomesphere.com/paper/1906.06755