Skip to yearly menu bar Skip to main content


Poster
in
Workshop: Knowledge and Logical Reasoning in the Era of Data-driven Learning

(Un)interpretability of Transformers: a case study with Dyck grammars

Kaiyue Wen · Yuchen Li · Bingbin Liu · Andrej Risteski


Abstract:

Transformers are typically trained on large datasets using the next-token prediction or masked language modeling objectives. Do these \emph{data-driven} training approaches guide Transformers to approximately implement some known \emph{rule-based} algorithms? Prior works seek to understand the algorithm implemented by a learned Transformer by peering and probing individual aspects of the model, such as the weight matrices or the attention patterns. In this work, through a combination of theoretical results and carefully controlled experiments on synthetic data, we take a critical view of methods that exclusively focus on individual parts of the model, rather than consider the network as a whole. We consider a simple synthetic setup of learning a Dyck language. Theoretically, we show that the set of models that can solve this task (exactly or approximately) satisfy a structural characterization derived from ideas in formal languages (the pumping lemma). We use this characterization to show that the set of optima is qualitatively rich: in particular, the attention pattern of a single layer can be ``nearly randomized'', while preserving the functionality of the network. We also show via extensive experiments that these constructions are not merely a theoretical artifact: even with severe constraints to the architecture of the model, vastly different solutions can be reached via standard training. Thus, interpretability claims based on individual heads or weight matrices in the Transformer can be misleading.

Chat is not available.