English

Clustering Head: A Visual Case Study of the Training Dynamics in Transformers

Machine Learning 2025-02-04 v2 Machine Learning

Abstract

This paper introduces the sparse modular addition task and examines how transformers learn it. We focus on transformers with embeddings in R2\R^2 and introduce a visual sandbox that provides comprehensive visualizations of each layer throughout the training process. We reveal a type of circuit, called "clustering heads," which learns the problem's invariants. We analyze the training dynamics of these circuits, highlighting two-stage learning, loss spikes due to high curvature or normalization layers, and the effects of initialization and curriculum learning.

Keywords

Cite

@article{arxiv.2410.24050,
  title  = {Clustering Head: A Visual Case Study of the Training Dynamics in Transformers},
  author = {Ambroise Odonnat and Wassim Bouaziz and Vivien Cabannes},
  journal= {arXiv preprint arXiv:2410.24050},
  year   = {2025}
}
R2 v1 2026-06-28T19:43:04.023Z