exBERT: A Visual Analysis Tool to Explore Learned Representations in Transformers Models
Benjamin Hoover, Hendrik Strobelt, Sebastian Gehrmann
TL;DR
The paper addresses the interpretability challenge of learned representations in Transformer models by introducing exBERT, an interactive visualization tool that couples attention analysis with token-embedding context via nearest-neighbor search in an annotated corpus. It combines an attention view, corpus view, and metadata summaries to give intuitive, human-centered insights into what attention-heads and embeddings encode. A case study on BERT using the Wizard of Oz corpus demonstrates how linguistic features emerge across layers and how multiple heads collaborate to capture dependencies. The work provides open-source code and a demo, enabling rapid experimentation and deeper understanding of learned representations in Transformers.
Abstract
Large language models can produce powerful contextual representations that lead to improvements across many NLP tasks. Since these models are typically guided by a sequence of learned self attention mechanisms and may comprise undesired inductive biases, it is paramount to be able to explore what the attention has learned. While static analyses of these models lead to targeted insights, interactive tools are more dynamic and can help humans better gain an intuition for the model-internal reasoning process. We present exBERT, an interactive tool named after the popular BERT language model, that provides insights into the meaning of the contextual representations by matching a human-specified input to similar contexts in a large annotated dataset. By aggregating the annotations of the matching similar contexts, exBERT helps intuitively explain what each attention-head has learned.
