What if attention were code? We show that many attention heads in transformer LMs can be replaced by human-readable Python programs. Swap them in and the model barely notices.
See our experiments here: Explaining Attention with Program Synthesis [https://arxiv.org/abs/2606.19317]