Efficient Transformers with Dynamic Token Pooling

Piotr Nawrot, Jan Chorowski, Adrian Łańcucki, Edoardo M. Ponti
11/17/2022
cs.CL
transformer-attention

Official code: PiotrNawrot/dynamic-pooling (67 stars, Python, last commit 2023-05-20).

Abstract

Transformers achieve unrivalled performance in modelling language, but remain inefficient in terms of memory and time complexity. A possible remedy is to reduce the sequence length in the intermediate layers by pooling fixed-length segments of tokens.

Show full abstract

Nevertheless, natural units of meaning, such as words or phrases, display varying sizes. To address this mismatch, we equip language models with a dynamic-pooling mechanism, which predicts segment boundaries in an autoregressive fashion. We compare several methods to infer boundaries, including end-to-end learning through stochastic re-parameterisation, supervised learning (based on segmentations from subword tokenizers or spikes in conditional entropy), as well as linguistically motivated boundaries. We perform character-level evaluation on texts from multiple datasets and morphologically diverse languages. The results demonstrate that dynamic pooling, which jointly segments and models language, is both faster and more accurate than vanilla Transformers and fixed-length pooling within the same computational budget.

View on arXivView PDF

Code Implementations(1)

Efficient Transformers with Dynamic Token Pooling

672Python, ShellNov 17, 20223 years ago

Similar Papers

Cite this paper

@article{nawrot2022efficient,
  title  = {Efficient Transformers with Dynamic Token Pooling},
  author = {Piotr Nawrot and Jan Chorowski and Adrian Łańcucki and Edoardo M. Ponti},
  year   = {2022},
  eprint = {2211.09761},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2211.09761}
}

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/2211.09761.svg)](https://codeofpaper.com/paper/2211.09761)

Discussion