Back to search

University of Washington

Evaluating Transformer's Ability to Learn Mildly Context-Sensitive Languages

Abstract

dc:description.abstract

Transformer models perform well on NLP tasks, but recent theoretical studies suggest their ability in modeling certain regular and context-free languages are limited. This creates a disparity given their success in modeling natural language strings, which are hypothesized to be mildly context-sensitive. We complement previous works on transformers and formal languages by relating them to mildly context-sensitive grammar formalisms with varying degrees of weak generative capacity. We test simple vanilla transformer models' ability to learn copying, crossing, and multiple agreements languages, and find that they generalize well to unseen in-domain data and have comparable performance to LSTMs, and learn highly interpretable self-attention patterns. However, such transformers cannot consistently recognize strings from the languages that are longer than the ones seen during training, and are often outperformed by LSTMs in this setting. We present initial evidence that suggests this is due to the limitation of the vanilla sinusoidal positional encoding.

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Wang, Shunjie
Advisor dc:contributor.advisor
  • Steinert-Threlkeld, Shane

Subjects

dc:subject × 3

Rights

dc:rights
Statement dc:rights
  • none
Language dc:language.iso
en_US

Identifiers

dc:identifier.*
Handle dc:identifier.uri
http://hdl.handle.net/1773/48053

Chain of custody

source
Harvested from
University of Washington
Base URL
digital.lib.washington.edu/server/oai/request
Last updated
2026-11-18
Source record
OAI-PMH GetRecord
citation

Wang, Shunjie. Evaluating Transformer's Ability to Learn Mildly Context-Sensitive Languages. 2021. http://hdl.handle.net/1773/48053