cs.LGMar 28, 2025

Concise One-Layer Transformers Can Perform Dictionary Lookup

Authors: Anton Hampe, Lena Strobl, Dana Angluin, Robert Frank

Organizations: Ume˚a University · Yale University

Abstract

While transformers have proven enormously successful in a range of tasks, their fundamental properties as models of computation are not well understood. This paper contributes to the study of the expressive capacity of transformers, focusing on their ability to perform the fundamental computational task of looking up a key in a dictionary. We prove that concise 1-layer transformers (i.e., with a polylog bound on the product of the number of heads, the embedding dimension, and precision) can perform this task when the key and value are represented in the same input position, but, under the pp-bit rational precision assumption, cannot perform it when the keys and values are represented in different input positions. Concise 2-layer transformers can perform the task in the second case. Experimentally, we find an alignment between what we have proven can be computed by concise transformers and what can be practically learned.

Figures & tables

Appendix figures & tables1 asset

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Latest Exact Match Attention

    Sep 22, 2026Moritz BrösamleTransformer ExpressivityMemory-Augmented Language Models

  2. Fixed Universal Transformers

    May 29, 2026Jingwen Liu, Alexandr Andoni, Daniel HsuTransformer ExpressivityTransformer

  3. Revisiting Padded Transformer Expressivity: Which Architectural Choices Matter and Which Don't

    May 28, 2026Anej Svete, William Merrill, Ryan Cotterell +1Transformer ExpressivityTransformer