A Transformer with Stack Attention

Jiaoda Li, Jennifer C. White, Mrinmaya Sachan, Ryan Cotterell
5/7/2024
cs.CL

No official code found. Best implementation: rycolab/stack-transformer (4 stars, last commit 2024-05-20).

Abstract

Natural languages are believed to be (mildly) context-sensitive. Despite underpinning remarkably capable large language models, transformers are unable to model many context-free language tasks. In an attempt to address this limitation in the modeling power of transformer-based language models, we propose augmenting them with a differentiable, stack-based attention mechanism. Our stack-based attention mechanism can be incorporated into any transformer-based language model and adds a level of interpretability to the model. We show that the addition of our stack-based attention mechanism enables the transformer to model some, but not all, deterministic context-free languages.

View on arXivView PDF

Code Implementations(1)

40PythonJul 28, 20232 years ago

Similar Papers

Cite this paper

@article{li2024transformer,
  title  = {A Transformer with Stack Attention},
  author = {Jiaoda Li and Jennifer C. White and Mrinmaya Sachan and Ryan Cotterell},
  year   = {2024},
  eprint = {2405.04515},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2405.04515v2}
}

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

Discussion