Self-Ablating Transformers: More Interpretability, Less Sparsity

Jeremias Ferrao, Luhan Mikaelson, Keenan Pepper, Natalia Perez-Campanero Antolin
5/1/2025
cs.LG

Official code: keenanpepper/self-ablating-transformers (7 stars, MIT, last commit 2025-06-18).

Abstract

A growing intuition in machine learning suggests a link between sparsity and interpretability. We introduce a novel self-ablation mechanism to investigate this connection ante-hoc in the context of language transformers. Our approach dynamically enforces a k-winner-takes-all constraint, forcing the model to demonstrate selective activation across neuron and attention units. Unlike post-hoc methods that analyze already-trained models, our approach integrates interpretability directly into model training, promoting feature localization from inception. Training small models on the TinyStories dataset and employing interpretability tests, we find that self-ablation leads to more localized circuits, concentrated feature representations, and increased neuron specialization without compromising language modelling performance. Surprisingly, our method also decreased overall sparsity, indicating that self-ablation promotes specialization rather than widespread inactivity. This reveals a complex interplay between sparsity and interpretability, where decreased global sparsity can coexist with increased local specialization, leading to enhanced interpretability. To facilitate reproducibility, we make our code available at https://github.com/keenanpepper/self-ablating-transformers.

View on arXivView PDF

Code Implementations(1)

MIT

A self-modeling transformer with an auxiliary output head that is an ablation mask for itself, in a second forward pass

71Shell, PythonAug 17, 20241 years agoMIT

Similar Papers

Cite this paper

@article{ferrao2025selfablating,
  title  = {Self-Ablating Transformers: More Interpretability, Less Sparsity},
  author = {Jeremias Ferrao and Luhan Mikaelson and Keenan Pepper and Natalia Perez-Campanero Antolin},
  year   = {2025},
  eprint = {2505.00509},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.00509v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.00509.svg)](https://codeofpaper.com/paper/2505.00509)

Discussion