English

Layerwise Dynamics for In-Context Classification in Transformers

Machine Learning 2026-04-20 v2 Artificial Intelligence

Abstract

Transformers can perform in-context classification from a few labeled examples, yet the inference-time algorithm remains opaque. We study multi-class linear classification in the hard no-margin regime and make the computation identifiable by enforcing feature- and label-permutation equivariance at every layer. This enables interpretability while maintaining functional equivalence and yields highly structured weights. From these models we extract an explicit depth-indexed recursion: an end-to-end identified, emergent update rule inside a softmax transformer, to our knowledge the first of its kind. Attention matrices formed from mixed feature-label Gram structure drive coupled updates of training points, labels, and the test probe. The resulting dynamics implement a geometry-driven algorithmic motif, which can provably amplify class separation and yields robust expected class alignment.

Keywords

Cite

@article{arxiv.2604.11613,
  title  = {Layerwise Dynamics for In-Context Classification in Transformers},
  author = {Patrick Lutz and Themistoklis Haris and Arjun Chandra and Aditya Gangrade and Venkatesh Saligrama},
  journal= {arXiv preprint arXiv:2604.11613},
  year   = {2026}
}
R2 v1 2026-07-01T12:06:42.720Z