Characterizing the Expressivity of Fixed-Precision Transformer Language Models

Jiaoda Li, Ryan Cotterell
5/29/2025
cs.CL

No confident code implementation found for this paper.

Abstract

Transformer-based language models (LMs) have achieved widespread empirical success, but their theoretical expressive power remains only partially understood. In this work, we analyze a restricted idealization of fixed-precision transformers with strict future masking, soft attention, and no positional encodings. We establish that this class of models is exactly as expressive as a specific fragment of linear temporal logic that contains only a single temporal operator: the past operator. We further connect this fragment to established classes in formal language theory, automata theory, and algebra, yielding a unified framework for understanding transformer expressivity under this idealization. Finally, we present empirical results that align closely with our theory: transformers trained on languages within their characterized expressive capacity generalize reliably across sequence lengths, while they consistently fail to generalize on languages beyond it.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2025characterizing,
  title  = {Characterizing the Expressivity of Fixed-Precision Transformer Language Models},
  author = {Jiaoda Li and Ryan Cotterell},
  year   = {2025},
  eprint = {2505.23623},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.23623v2}
}

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

Discussion