Manuscript Offprint

arXiv:2609.04046

The Head Complexity of Boolean Functions in Single-Layer Attention

Rajmohan Rajaraman, Ravi Sundaram, Amanuel Tesfaye

Abstract

What can a single layer of self-attention compute? We study head complexity: the minimum number of attention heads required to compute a function in a one-layer attention-only model. We establish an exact hierarchy under this measure: kk heads compute kk-bit parity but cannot compute (k+1)(k+1)-bit parity.

The lower bound is unconditional in the two resources a transformer might otherwise exploit; it holds at unbounded embedding dimension and unbounded numerical precision. The proof rests on an alternating-sum obstruction: after clearing the softmax denominators, every monomial in the resulting decision polynomial omits at least one of the k+1k+1 input bits, forcing its correlation with parity to vanish. The same obstruction yields lower bounds for related tasks, including the well-studied multi-hop induction-head task.

We also establish compactness bounds for embedding dimension and numerical precision. Specifically, a compactness theorem shows that any function computable at all can be computed with embedding dimension and precision bounded by the discrete data of the task, namely, head count, alphabet size, and length. Thus, potentially unbounded dimension or precision provably cannot substitute for heads. Finally, we derive nearly matching universal bounds for general binary functions: 2n2^n heads suffice to compute every nn-bit binary function, with one head per monomial in its multilinear expansion, while a counting argument shows almost all such functions require Ω(2n/n2)\Omega(2^n/n^2) heads. This lower bound matches the upper bound to within a poly(n)(n) factor, even when dimension and precision are unbounded. Together, these results characterize head requirements for Boolean computation in this model.

*Northeastern University.

1 Introduction

To understand what a transformer can compute, we analyze it not as an empirical artifact but as a formal model of computation. Half a century ago, the pioneers of circuit complexity asked how many logic gates a function requires, and the structural limits they proved for bounded-depth circuits became bedrock for the field. For a single attention layer, the natural analogue of the gate is the attention head, and the natural question is its head complexity: the minimum number of heads needed to compute a target function. This lens grew out of the two-head study [TKRS26], where two narrow heads solve the Endpoint Selection Problem (ESP) that a single head of unbounded width cannot; this motivated head count as a resource for studying single-layer expressivity. The present paper extends that observation to an exact hierarchy across head counts and to worst-case bounds for Boolean functions.

Why isolate a single attention layer? We isolate a single attention layer in order to study head count separately from depth and feed-forward computation. This restricted setting permits exact upper and lower bounds. Settling the head complexity has two additional payoffs. It is a statement about cost — heads carry parameters and quadratic attention compute, so a lower bound on heads lower-bounds model size within this attention-only setting. And it grounds mechanistic interpretability, whose unit of analysis is the individual head. We therefore take the number of heads as the resource being measured.

References (33)